summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2020-07-13 12:00:32 -0400
committerGitHub <noreply@github.com>2020-07-13 12:00:32 -0400
commit3cec3881062490727c5fff1b16b53f0176f976f0 (patch)
treea26576249a456556bfe2557d273af5192bd41985 /cloudinit
parentfecbd81889011e8a75badd18935297f3494fe485 (diff)
downloadvyos-cloud-init-3cec3881062490727c5fff1b16b53f0176f976f0.tar.gz
vyos-cloud-init-3cec3881062490727c5fff1b16b53f0176f976f0.zip
cloudinit: remove global disable of pylint W0105 and fix errors (#480)
This includes a fix to a test that had a string concatenation issue, and so was only testing a prefix of what was intended.
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/analyze/show.py41
-rw-r--r--cloudinit/config/cc_resizefs.py14
-rw-r--r--cloudinit/distros/opensuse.py2
-rw-r--r--cloudinit/net/eni.py6
-rwxr-xr-xcloudinit/sources/DataSourceAzure.py14
-rw-r--r--cloudinit/sources/DataSourceHetzner.py6
6 files changed, 37 insertions, 46 deletions
diff --git a/cloudinit/analyze/show.py b/cloudinit/analyze/show.py
index cca1fa7f..0c825b23 100644
--- a/cloudinit/analyze/show.py
+++ b/cloudinit/analyze/show.py
@@ -15,28 +15,25 @@ from cloudinit import subp
from cloudinit import util
from cloudinit.distros import uses_systemd
-# An event:
-'''
-{
- "description": "executing late commands",
- "event_type": "start",
- "level": "INFO",
- "name": "cmd-install/stage-late"
- "origin": "cloudinit",
- "timestamp": 1461164249.1590767,
-},
-
- {
- "description": "executing late commands",
- "event_type": "finish",
- "level": "INFO",
- "name": "cmd-install/stage-late",
- "origin": "cloudinit",
- "result": "SUCCESS",
- "timestamp": 1461164249.1590767
- }
-
-'''
+# Example events:
+# {
+# "description": "executing late commands",
+# "event_type": "start",
+# "level": "INFO",
+# "name": "cmd-install/stage-late"
+# "origin": "cloudinit",
+# "timestamp": 1461164249.1590767,
+# }
+# {
+# "description": "executing late commands",
+# "event_type": "finish",
+# "level": "INFO",
+# "name": "cmd-install/stage-late",
+# "origin": "cloudinit",
+# "result": "SUCCESS",
+# "timestamp": 1461164249.1590767
+# }
+
format_key = {
'%d': 'delta',
'%D': 'description',
diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py
index 8de4db30..978d2ee0 100644
--- a/cloudinit/config/cc_resizefs.py
+++ b/cloudinit/config/cc_resizefs.py
@@ -118,14 +118,12 @@ def _can_skip_resize_ufs(mount_point, devpth):
if o == "-f":
frag_sz = int(a)
# check the current partition size
- """
- # gpart show /dev/da0
-=> 40 62914480 da0 GPT (30G)
- 40 1024 1 freebsd-boot (512K)
- 1064 58719232 2 freebsd-ufs (28G)
- 58720296 3145728 3 freebsd-swap (1.5G)
- 61866024 1048496 - free - (512M)
- """
+ # Example output from `gpart show /dev/da0`:
+ # => 40 62914480 da0 GPT (30G)
+ # 40 1024 1 freebsd-boot (512K)
+ # 1064 58719232 2 freebsd-ufs (28G)
+ # 58720296 3145728 3 freebsd-swap (1.5G)
+ # 61866024 1048496 - free - (512M)
expect_sz = None
m = re.search('^(/dev/.+)p([0-9])$', devpth)
gpart_res = _get_gpart_output(m.group(1))
diff --git a/cloudinit/distros/opensuse.py b/cloudinit/distros/opensuse.py
index ffb7d0e8..b8e557b8 100644
--- a/cloudinit/distros/opensuse.py
+++ b/cloudinit/distros/opensuse.py
@@ -185,7 +185,7 @@ class Distro(distros.Distro):
def preferred_ntp_clients(self):
"""The preferred ntp client is dependent on the version."""
- """Allow distro to determine the preferred ntp client list"""
+ # Allow distro to determine the preferred ntp client list
if not self._preferred_ntp_clients:
distro_info = util.system_info()['dist']
name = distro_info[0]
diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py
index b4c69457..13c041f3 100644
--- a/cloudinit/net/eni.py
+++ b/cloudinit/net/eni.py
@@ -483,10 +483,8 @@ class Renderer(renderer.Renderer):
if searchdomains:
lo['subnets'][0]["dns_search"] = (" ".join(searchdomains))
- ''' Apply a sort order to ensure that we write out
- the physical interfaces first; this is critical for
- bonding
- '''
+ # Apply a sort order to ensure that we write out the physical
+ # interfaces first; this is critical for bonding
order = {
'loopback': 0,
'physical': 1,
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 41431a7a..5e25b956 100755
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -166,12 +166,11 @@ def get_resource_disk_on_freebsd(port_id):
port_id = port_id - 2
g1 = "000" + str(port_id)
g0g1 = "{0}-{1}".format(g0, g1)
- """
- search 'X' from
- 'dev.storvsc.X.%pnpinfo:
- classid=32412632-86cb-44a2-9b5c-50d1417354f5
- deviceid=00000000-0001-8899-0000-000000000000'
- """
+
+ # search 'X' from
+ # 'dev.storvsc.X.%pnpinfo:
+ # classid=32412632-86cb-44a2-9b5c-50d1417354f5
+ # deviceid=00000000-0001-8899-0000-000000000000'
sysctl_out = get_dev_storvsc_sysctl()
storvscid = find_storvscid_from_sysctl_pnpinfo(sysctl_out, g0g1)
@@ -1485,13 +1484,12 @@ def maybe_remove_ubuntu_network_config_scripts(paths=None):
def _is_platform_viable(seed_dir):
+ """Check platform environment to report if this datasource may run."""
with events.ReportEventStack(
name="check-platform-viability",
description="found azure asset tag",
parent=azure_ds_reporter
) as evt:
-
- """Check platform environment to report if this datasource may run."""
asset_tag = util.read_dmi_data('chassis-asset-tag')
if asset_tag == AZURE_CHASSIS_ASSET_TAG:
return True
diff --git a/cloudinit/sources/DataSourceHetzner.py b/cloudinit/sources/DataSourceHetzner.py
index 70e4274c..a86035e0 100644
--- a/cloudinit/sources/DataSourceHetzner.py
+++ b/cloudinit/sources/DataSourceHetzner.py
@@ -69,9 +69,9 @@ class DataSourceHetzner(sources.DataSource):
self.userdata_raw = hc_helper.maybe_b64decode(ud)
self.metadata_full = md
- """hostname is name provided by user at launch. The API enforces
- it is a valid hostname, but it is not guaranteed to be resolvable
- in dns or fully qualified."""
+ # hostname is name provided by user at launch. The API enforces it is
+ # a valid hostname, but it is not guaranteed to be resolvable in dns or
+ # fully qualified.
self.metadata['instance-id'] = md['instance-id']
self.metadata['local-hostname'] = md['hostname']
self.metadata['network-config'] = md.get('network-config', None)