Merge ~ajorgens/cloud-init:py27-analyze into cloud-init:master

Proposed by Andrew Jorgensen
Status: Merged
Approved by: Scott Moser
Approved revision: 95f50446acb2b0ae71eb2633ce20930d30fded5d
Merged at revision: 0ab9859168eb0ba4fc348843e866751cfc67181f
Proposed branch: ~ajorgens/cloud-init:py27-analyze
Merge into: cloud-init:master
Diff against target: 35 lines (+3/-3)
2 files modified
cloudinit/analyze/__main__.py (+2/-2)
cloudinit/analyze/show.py (+1/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Scott Moser Approve
Review via email: mp+329653@code.launchpad.net

Description of the change

Some Python 3 exception names crept into the cloud-init analyze code. This patches those back out at a cost of catching less specific parents of the desired exceptions.

To post a comment you must log in.
Revision history for this message
Chad Smith (chad.smith) wrote :

Oops. Thanks Andrew. Yeah, sloppy. my bad. Hmm wondering if we need IOError there too.

Revision history for this message
Andrew Jorgensen (ajorgens) wrote :

> Oops. Thanks Andrew. Yeah, sloppy. my bad. Hmm wondering if we need IOError
> there too.

I don't *think* so.

Revision history for this message
Scott Moser (smoser) wrote :

looks good.
FileNotFoundError and PermissionError are both OSError

Revision history for this message
Scott Moser (smoser) :
review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:95f50446acb2b0ae71eb2633ce20930d30fded5d
https://jenkins.ubuntu.com/server/job/cloud-init-ci/210/
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/210/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/analyze/__main__.py b/cloudinit/analyze/__main__.py
2index 71cba4f..69b9e43 100644
3--- a/cloudinit/analyze/__main__.py
4+++ b/cloudinit/analyze/__main__.py
5@@ -130,7 +130,7 @@ def configure_io(args):
6 else:
7 try:
8 infh = open(args.infile, 'r')
9- except (FileNotFoundError, PermissionError):
10+ except OSError:
11 sys.stderr.write('Cannot open file %s\n' % args.infile)
12 sys.exit(1)
13
14@@ -139,7 +139,7 @@ def configure_io(args):
15 else:
16 try:
17 outfh = open(args.outfile, 'w')
18- except PermissionError:
19+ except OSError:
20 sys.stderr.write('Cannot open file %s\n' % args.outfile)
21 sys.exit(1)
22
23diff --git a/cloudinit/analyze/show.py b/cloudinit/analyze/show.py
24index 3b356bb..3e778b8 100644
25--- a/cloudinit/analyze/show.py
26+++ b/cloudinit/analyze/show.py
27@@ -201,7 +201,7 @@ def load_events(infile, rawdata=None):
28 j = None
29 try:
30 j = json.loads(data)
31- except json.JSONDecodeError:
32+ except ValueError:
33 pass
34
35 return j, data

Subscribers

People subscribed via source and target branches