Merge ~smoser/cloud-init:fix/pyflakes-2.0.0-reported-issues into cloud-init:master

Proposed by Scott Moser
Status: Merged
Approved by: Scott Moser
Approved revision: a50bd3850e86029b1f07b65521976553caa2f167
Merge reported by: Scott Moser
Merged at revision: 4ba4639b86edad7ec89a55a61b7d9075f92d2166
Proposed branch: ~smoser/cloud-init:fix/pyflakes-2.0.0-reported-issues
Merge into: cloud-init:master
Diff against target: 110 lines (+15/-15)
6 files modified
cloudinit/config/cc_mounts.py (+1/-1)
cloudinit/handlers/upstart_job.py (+1/-1)
cloudinit/sources/DataSourceAltCloud.py (+8/-8)
cloudinit/sources/DataSourceNoCloud.py (+2/-2)
cloudinit/sources/DataSourceOpenNebula.py (+1/-1)
cloudinit/util.py (+2/-2)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Ryan Harper Approve
Joshua Powers (community) Approve
Review via email: mp+347060@code.launchpad.net

Commit message

pyflakes: fix unused variable references identified by pyflakes 2.0.0.

A newer version of pyflakes (2.0.0) was released.
It identifed some unused variables that version 1.6.0 did not identify.
The change here merely fixes those unused variables.

Description of the change

see commit message

To post a comment you must log in.
Revision history for this message
Joshua Powers (powersj) :
review: Approve
Revision history for this message
Ryan Harper (raharper) :
review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/43/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/43/rebuild

review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

An upstream commit landed for this bug.

To view that commit see the following URL:
https://git.launchpad.net/cloud-init/commit/?id=4ba4639b

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py
2index eca6ea3..339baba 100644
3--- a/cloudinit/config/cc_mounts.py
4+++ b/cloudinit/config/cc_mounts.py
5@@ -233,7 +233,7 @@ def setup_swapfile(fname, size=None, maxsize=None):
6 if str(size).lower() == "auto":
7 try:
8 memsize = util.read_meminfo()['total']
9- except IOError as e:
10+ except IOError:
11 LOG.debug("Not creating swap: failed to read meminfo")
12 return
13
14diff --git a/cloudinit/handlers/upstart_job.py b/cloudinit/handlers/upstart_job.py
15index 1ca92d4..dc33876 100644
16--- a/cloudinit/handlers/upstart_job.py
17+++ b/cloudinit/handlers/upstart_job.py
18@@ -97,7 +97,7 @@ def _has_suitable_upstart():
19 else:
20 util.logexc(LOG, "dpkg --compare-versions failed [%s]",
21 e.exit_code)
22- except Exception as e:
23+ except Exception:
24 util.logexc(LOG, "dpkg --compare-versions failed")
25 return False
26 else:
27diff --git a/cloudinit/sources/DataSourceAltCloud.py b/cloudinit/sources/DataSourceAltCloud.py
28index f6e86f3..24fd65f 100644
29--- a/cloudinit/sources/DataSourceAltCloud.py
30+++ b/cloudinit/sources/DataSourceAltCloud.py
31@@ -184,11 +184,11 @@ class DataSourceAltCloud(sources.DataSource):
32 cmd = CMD_PROBE_FLOPPY
33 (cmd_out, _err) = util.subp(cmd)
34 LOG.debug('Command: %s\nOutput%s', ' '.join(cmd), cmd_out)
35- except ProcessExecutionError as _err:
36- util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), _err)
37+ except ProcessExecutionError as e:
38+ util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), e)
39 return False
40- except OSError as _err:
41- util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), _err)
42+ except OSError as e:
43+ util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), e)
44 return False
45
46 floppy_dev = '/dev/fd0'
47@@ -197,11 +197,11 @@ class DataSourceAltCloud(sources.DataSource):
48 try:
49 (cmd_out, _err) = util.udevadm_settle(exists=floppy_dev, timeout=5)
50 LOG.debug('Command: %s\nOutput%s', ' '.join(cmd), cmd_out)
51- except ProcessExecutionError as _err:
52- util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), _err)
53+ except ProcessExecutionError as e:
54+ util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), e)
55 return False
56- except OSError as _err:
57- util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), _err)
58+ except OSError as e:
59+ util.logexc(LOG, 'Failed command: %s\n%s', ' '.join(cmd), e)
60 return False
61
62 try:
63diff --git a/cloudinit/sources/DataSourceNoCloud.py b/cloudinit/sources/DataSourceNoCloud.py
64index 5d3a8dd..2daea59 100644
65--- a/cloudinit/sources/DataSourceNoCloud.py
66+++ b/cloudinit/sources/DataSourceNoCloud.py
67@@ -78,7 +78,7 @@ class DataSourceNoCloud(sources.DataSource):
68 LOG.debug("Using seeded data from %s", path)
69 mydata = _merge_new_seed(mydata, seeded)
70 break
71- except ValueError as e:
72+ except ValueError:
73 pass
74
75 # If the datasource config had a 'seedfrom' entry, then that takes
76@@ -117,7 +117,7 @@ class DataSourceNoCloud(sources.DataSource):
77 try:
78 seeded = util.mount_cb(dev, _pp2d_callback,
79 pp2d_kwargs)
80- except ValueError as e:
81+ except ValueError:
82 if dev in label_list:
83 LOG.warning("device %s with label=%s not a"
84 "valid seed.", dev, label)
85diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py
86index d4a4111..16c1078 100644
87--- a/cloudinit/sources/DataSourceOpenNebula.py
88+++ b/cloudinit/sources/DataSourceOpenNebula.py
89@@ -378,7 +378,7 @@ def read_context_disk_dir(source_dir, asuser=None):
90 if asuser is not None:
91 try:
92 pwd.getpwnam(asuser)
93- except KeyError as e:
94+ except KeyError:
95 raise BrokenContextDiskDir(
96 "configured user '{user}' does not exist".format(
97 user=asuser))
98diff --git a/cloudinit/util.py b/cloudinit/util.py
99index c0473b8..6ea6ca7 100644
100--- a/cloudinit/util.py
101+++ b/cloudinit/util.py
102@@ -2531,8 +2531,8 @@ def _call_dmidecode(key, dmidecode_path):
103 if result.replace(".", "") == "":
104 return ""
105 return result
106- except (IOError, OSError) as _err:
107- LOG.debug('failed dmidecode cmd: %s\n%s', cmd, _err)
108+ except (IOError, OSError) as e:
109+ LOG.debug('failed dmidecode cmd: %s\n%s', cmd, e)
110 return None
111
112

Subscribers

People subscribed via source and target branches