From cb046bc4fc5b295821300f606119a95a78bb4add Mon Sep 17 00:00:00 2001 From: Louis Taylor Date: Wed, 22 Oct 2014 15:44:36 +0000 Subject: 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 --- glanceclient/v1/shell.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'glanceclient/v1/shell.py') 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} -- cgit v1.2.1