summaryrefslogtreecommitdiff
path: root/tools/mock-meta.py
diff options
context:
space:
mode:
authorJoshua Powers <josh.powers@canonical.com>2017-01-30 15:31:36 -0700
committerScott Moser <smoser@ubuntu.com>2017-02-05 17:37:26 -0600
commit5f14a0b1ca3079e4ab43d615840866a4b7d8df6a (patch)
treede553e9e6cf3b56cea5e13fd9d6c0b2ec40b6ab9 /tools/mock-meta.py
parente98709225510ee99ee0269c558c82b3e693e38e5 (diff)
downloadvyos-cloud-init-5f14a0b1ca3079e4ab43d615840866a4b7d8df6a.tar.gz
vyos-cloud-init-5f14a0b1ca3079e4ab43d615840866a4b7d8df6a.zip
code-style: make master pass pycodestyle (2.3.1) cleanly, currently:
$ pycodestyle cloudinit/ tests/ tools/ tools/make-mime.py:25:5: E722 do not use bare except' tools/mock-meta.py:252:17: E722 do not use bare except' For tools/make-mime.py:25:5: E722 do not use bare except' the use case is when someone runs ./make-mime.py --attach commis instead of ./make-mime.py --attach commissaire.txt:x-commissaire-host The split can cause a ValueError potentially if there is no: For tools/mock-meta.py:262:17: E722 do not use bare except' the use case is a dictionary look up occurs potentially when an unknown key is given: key_name = key_ids[key_id] Do note that version 2.3.0 falsely reported a dozen or so E302 and E306 errors.
Diffstat (limited to 'tools/mock-meta.py')
-rwxr-xr-xtools/mock-meta.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/mock-meta.py b/tools/mock-meta.py
index a0d99441..95fc4659 100755
--- a/tools/mock-meta.py
+++ b/tools/mock-meta.py
@@ -259,7 +259,10 @@ class MetaDataHandler(object):
try:
key_id = int(mybe_key)
key_name = key_ids[key_id]
- except:
+ except ValueError:
+ raise WebException(hclient.BAD_REQUEST,
+ "%s: not an integer" % mybe_key)
+ except KeyError:
raise WebException(hclient.BAD_REQUEST,
"Unknown key id %r" % mybe_key)
# Extract the possible sub-params