diff options
author | Andrew Jorgensen <ajorgens@amazon.com> | 2017-08-25 22:17:34 +0000 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2017-08-25 16:24:53 -0700 |
commit | 0ab9859168eb0ba4fc348843e866751cfc67181f (patch) | |
tree | fd342edc33a9ee908e6ca273c8dc14332ec90226 /cloudinit/analyze | |
parent | 556a0220734097aa4e9fbfd93c8f263684232b3b (diff) | |
download | vyos-cloud-init-0ab9859168eb0ba4fc348843e866751cfc67181f.tar.gz vyos-cloud-init-0ab9859168eb0ba4fc348843e866751cfc67181f.zip |
cloud-init analyze: fix issues running under python 2.
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.
Diffstat (limited to 'cloudinit/analyze')
-rw-r--r-- | cloudinit/analyze/__main__.py | 4 | ||||
-rw-r--r-- | cloudinit/analyze/show.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/cloudinit/analyze/__main__.py b/cloudinit/analyze/__main__.py index 71cba4f2..69b9e43e 100644 --- a/cloudinit/analyze/__main__.py +++ b/cloudinit/analyze/__main__.py @@ -130,7 +130,7 @@ def configure_io(args): else: try: infh = open(args.infile, 'r') - except (FileNotFoundError, PermissionError): + except OSError: sys.stderr.write('Cannot open file %s\n' % args.infile) sys.exit(1) @@ -139,7 +139,7 @@ def configure_io(args): else: try: outfh = open(args.outfile, 'w') - except PermissionError: + except OSError: sys.stderr.write('Cannot open file %s\n' % args.outfile) sys.exit(1) diff --git a/cloudinit/analyze/show.py b/cloudinit/analyze/show.py index 3b356bb8..3e778b8b 100644 --- a/cloudinit/analyze/show.py +++ b/cloudinit/analyze/show.py @@ -201,7 +201,7 @@ def load_events(infile, rawdata=None): j = None try: j = json.loads(data) - except json.JSONDecodeError: + except ValueError: pass return j, data |