diff options
author | Scott Moser <smoser@brickies.net> | 2016-11-10 21:01:12 -0500 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-11-10 21:01:12 -0500 |
commit | 584b8434872322a9f617831742cc6b15977ecfbc (patch) | |
tree | 2b4bf7cba8b20817789276ed34a108172ec4e119 | |
parent | bf4010a9c379e2109b030af558033014f9137f47 (diff) | |
download | vyos-cloud-init-584b8434872322a9f617831742cc6b15977ecfbc.tar.gz vyos-cloud-init-584b8434872322a9f617831742cc6b15977ecfbc.zip |
pep8: fix style errors reported by pycodestyle 2.1.0
pycodestyle 2.1.0 is in Ubuntu zesty, and complained about the
changes made here. Simple style changes. This makes 'make pep8'
pass again when built in a zesty build system with proposed enabled.
-rw-r--r-- | cloudinit/config/cc_ca_certs.py | 4 | ||||
-rw-r--r-- | cloudinit/config/cc_growpart.py | 1 | ||||
-rw-r--r-- | cloudinit/config/cc_resizefs.py | 1 | ||||
-rw-r--r-- | cloudinit/handlers/upstart_job.py | 1 | ||||
-rw-r--r-- | cloudinit/safeyaml.py | 1 | ||||
-rw-r--r-- | cloudinit/sources/DataSourceAliYun.py | 1 | ||||
-rw-r--r-- | cloudinit/sources/DataSourceAltCloud.py | 1 | ||||
-rw-r--r-- | cloudinit/sources/DataSourceBigstep.py | 1 | ||||
-rw-r--r-- | cloudinit/sources/DataSourceEc2.py | 1 | ||||
-rw-r--r-- | cloudinit/sources/DataSourceGCE.py | 1 | ||||
-rw-r--r-- | cloudinit/util.py | 4 | ||||
-rwxr-xr-x | tools/hacking.py | 1 |
12 files changed, 14 insertions, 4 deletions
diff --git a/cloudinit/config/cc_ca_certs.py b/cloudinit/config/cc_ca_certs.py index 8d319e22..df77ba62 100644 --- a/cloudinit/config/cc_ca_certs.py +++ b/cloudinit/config/cc_ca_certs.py @@ -82,8 +82,8 @@ def add_ca_certs(certs): # We have to strip the content because blank lines in the file # causes subsequent entries to be ignored. (LP: #1077020) orig = util.load_file(CA_CERT_CONFIG) - cur_cont = '\n'.join([l for l in orig.splitlines() - if l != CA_CERT_FILENAME]) + cur_cont = '\n'.join([line for line in orig.splitlines() + if line != CA_CERT_FILENAME]) out = "%s\n%s\n" % (cur_cont.rstrip(), CA_CERT_FILENAME) util.write_file(CA_CERT_CONFIG, out, omode="wb") diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py index a95e6c81..03df6047 100644 --- a/cloudinit/config/cc_growpart.py +++ b/cloudinit/config/cc_growpart.py @@ -354,4 +354,5 @@ def handle(_name, cfg, _cloud, log, _args): else: log.debug("'%s' %s: %s" % (entry, action, msg)) + RESIZERS = (('growpart', ResizeGrowPart), ('gpart', ResizeGpart)) diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py index 1b917966..f3c36c9b 100644 --- a/cloudinit/config/cc_resizefs.py +++ b/cloudinit/config/cc_resizefs.py @@ -69,6 +69,7 @@ def _resize_xfs(mount_point, devpth): def _resize_ufs(mount_point, devpth): return ('growfs', devpth) + # Do not use a dictionary as these commands should be able to be used # for multiple filesystem types if possible, e.g. one command for # ext2, ext3 and ext4. diff --git a/cloudinit/handlers/upstart_job.py b/cloudinit/handlers/upstart_job.py index ab381e00..309af91e 100644 --- a/cloudinit/handlers/upstart_job.py +++ b/cloudinit/handlers/upstart_job.py @@ -116,4 +116,5 @@ def _has_suitable_upstart(): else: return True + SUITABLE_UPSTART = _has_suitable_upstart() diff --git a/cloudinit/safeyaml.py b/cloudinit/safeyaml.py index eba5d056..f6a3f765 100644 --- a/cloudinit/safeyaml.py +++ b/cloudinit/safeyaml.py @@ -23,6 +23,7 @@ class _CustomSafeLoader(yaml.SafeLoader): def construct_python_unicode(self, node): return self.construct_scalar(node) + _CustomSafeLoader.add_constructor( u'tag:yaml.org,2002:python/unicode', _CustomSafeLoader.construct_python_unicode) diff --git a/cloudinit/sources/DataSourceAliYun.py b/cloudinit/sources/DataSourceAliYun.py index 19957212..535813ab 100644 --- a/cloudinit/sources/DataSourceAliYun.py +++ b/cloudinit/sources/DataSourceAliYun.py @@ -38,6 +38,7 @@ def parse_public_keys(public_keys): keys.extend(key) return keys + # Used to match classes to dependencies datasources = [ (DataSourceAliYun, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)), diff --git a/cloudinit/sources/DataSourceAltCloud.py b/cloudinit/sources/DataSourceAltCloud.py index 20345389..fac7bbcc 100644 --- a/cloudinit/sources/DataSourceAltCloud.py +++ b/cloudinit/sources/DataSourceAltCloud.py @@ -270,6 +270,7 @@ class DataSourceAltCloud(sources.DataSource): else: return False + # Used to match classes to dependencies # Source DataSourceAltCloud does not really depend on networking. # In the future 'dsmode' like behavior can be added to offer user diff --git a/cloudinit/sources/DataSourceBigstep.py b/cloudinit/sources/DataSourceBigstep.py index f80956a5..e8fd0088 100644 --- a/cloudinit/sources/DataSourceBigstep.py +++ b/cloudinit/sources/DataSourceBigstep.py @@ -46,6 +46,7 @@ def get_url_from_file(): raise return content + # Used to match classes to dependencies datasources = [ (DataSourceBigstep, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)), diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py index c0b7ddd3..acbc2356 100644 --- a/cloudinit/sources/DataSourceEc2.py +++ b/cloudinit/sources/DataSourceEc2.py @@ -202,6 +202,7 @@ class DataSourceEc2(sources.DataSource): return az[:-1] return None + # Used to match classes to dependencies datasources = [ (DataSourceEc2, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)), diff --git a/cloudinit/sources/DataSourceGCE.py b/cloudinit/sources/DataSourceGCE.py index 6c12d703..5ed59559 100644 --- a/cloudinit/sources/DataSourceGCE.py +++ b/cloudinit/sources/DataSourceGCE.py @@ -156,6 +156,7 @@ class DataSourceGCE(sources.DataSource): def region(self): return self.availability_zone.rsplit('-', 1)[0] + # Used to match classes to dependencies datasources = [ (DataSourceGCE, (sources.DEP_FILESYSTEM, sources.DEP_NETWORK)), diff --git a/cloudinit/util.py b/cloudinit/util.py index 9a3d3cd7..ed2d93e5 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -2030,8 +2030,8 @@ def parse_mount_info(path, mountinfo_lines, log=LOG): continue # Ignore mounts where the common path is not the same. - l = min(len(mount_point_elements), len(path_elements)) - if mount_point_elements[0:l] != path_elements[0:l]: + x = min(len(mount_point_elements), len(path_elements)) + if mount_point_elements[0:x] != path_elements[0:x]: continue # Ignore mount points higher than an already seen mount diff --git a/tools/hacking.py b/tools/hacking.py index 716c1154..2d366a0a 100755 --- a/tools/hacking.py +++ b/tools/hacking.py @@ -156,6 +156,7 @@ def add_cloud(): if name.startswith("cloud_"): exec("pep8.%s = %s" % (name, name)) + if __name__ == "__main__": # NOVA based 'hacking.py' error codes start with an N pep8.ERRORCODE_REGEX = re.compile(r'[EWN]\d{3}') |