summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykhailo Dovgal <mdovgal@mirantis.com>2017-01-26 16:53:52 +0200
committerMykhailo Dovgal <mdovgal@mirantis.com>2017-01-26 17:19:12 +0200
commit209eebbb127db6552610c44f36bea1d5d97eadbf (patch)
tree4888d3bf4de1f337fafeb403011d6159112efdd3
parentb73b3932404c4645e05aaefae5502ab2304a5334 (diff)
downloadpython-cinderclient-209eebbb127db6552610c44f36bea1d5d97eadbf.tar.gz
Fix getting metadata attr error in snapshot-list command
Because of 'start_version' parameter in decorator here [0] we won't have metadata attr in args using api versions from 3.0 to 3.21. This patch changes getting metadata from args logic for compatibility with the api versions 3.0 - 3.21. [0] - https://github.com/openstack/python-cinderclient/blob/b73b3932404c4645e05aaefae5502ab2304a5334/cinderclient/v3/shell.py#L1237 Change-Id: I4aa099556c57c49e9ad74fe80e5591d738cf3aa0 Closes-Bug: #1659561
-rw-r--r--cinderclient/v3/shell.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py
index cf3e425..e779869 100644
--- a/cinderclient/v3/shell.py
+++ b/cinderclient/v3/shell.py
@@ -1245,14 +1245,20 @@ def do_snapshot_list(cs, args):
if args.display_name is not None:
args.name = args.display_name
+ metadata = None
+ try:
+ if args.metadata:
+ metadata = shell_utils.extract_metadata(args)
+ except AttributeError:
+ pass
+
search_opts = {
'all_tenants': all_tenants,
'name': args.name,
'status': args.status,
'volume_id': args.volume_id,
'project_id': args.tenant,
- 'metadata': shell_utils.extract_metadata(args)
- if args.metadata else None,
+ 'metadata': metadata
}
snapshots = cs.volume_snapshots.list(search_opts=search_opts,
@@ -1263,4 +1269,4 @@ def do_snapshot_list(cs, args):
sortby_index = None if args.sort else 0
utils.print_list(snapshots,
['ID', 'Volume ID', 'Status', 'Name', 'Size'],
- sortby_index=sortby_index) \ No newline at end of file
+ sortby_index=sortby_index)