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] - b73b393240/cinderclient/v3/shell.py (L1237)
Change-Id: I4aa099556c57c49e9ad74fe80e5591d738cf3aa0
Closes-Bug: #1659561
This commit is contained in:
@@ -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)
|
||||
sortby_index=sortby_index)
|
||||
|
Reference in New Issue
Block a user