summaryrefslogtreecommitdiff
path: root/glanceclient/v1/shell.py
diff options
context:
space:
mode:
authorLouis Taylor <kragniz@gmail.com>2014-10-22 15:44:36 +0000
committerLouis Taylor <kragniz@gmail.com>2015-01-08 17:01:17 +0000
commitcb046bc4fc5b295821300f606119a95a78bb4add (patch)
tree7b2091ae9b1941f1574488cc9129fd2fa203ca38 /glanceclient/v1/shell.py
parentdac71b4be941e529238cc6bbd6d2ef50bb1adc47 (diff)
downloadpython-glanceclient-cb046bc4fc5b295821300f606119a95a78bb4add.tar.gz
Add validation to --property-filter in v1 shell
Previously, using --property-filter with invalid arguments resulted in a rather cryptic error message: $ glance image-list --property-filter name dictionary update sequence element #0 has length 1; 2 is required Now, something which is human decipherable is printed: $ glance image-list --property-filter name Argument --property-filter requires properties in the format KEY=VALUE Change-Id: I61d19894fd8864bdca2fa3f627da3c7eb1341c51
Diffstat (limited to 'glanceclient/v1/shell.py')
-rw-r--r--glanceclient/v1/shell.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/glanceclient/v1/shell.py b/glanceclient/v1/shell.py
index d4d117e..d366d22 100644
--- a/glanceclient/v1/shell.py
+++ b/glanceclient/v1/shell.py
@@ -80,6 +80,10 @@ def do_image_list(gc, args):
if args.properties:
property_filter_items = [p.split('=', 1) for p in args.properties]
+ if any(len(pair) != 2 for pair in property_filter_items):
+ utils.exit('Argument --property-filter requires properties in the'
+ ' format KEY=VALUE')
+
filters['properties'] = dict(property_filter_items)
kwargs = {'filters': filters}