Magnum client to support sync and async bay opts

Providing support to magnum client for Sync and Async Bay
operations based on the magnum-api-version supplied.

Change-Id: If2ad6ed438a74e47f83a2775560ded413feaf315
Depends-On: I4ca1f9f386b6417726154c466e7a9104b6e6e5e1
This commit is contained in:
Vijendar Komalla 2016-06-23 15:09:09 -05:00
parent d3a15bde0b
commit f12e7a99f9
2 changed files with 22 additions and 4 deletions

View File

@ -115,7 +115,13 @@ def do_bay_create(cs, args):
opts['bay_create_timeout'] = args.timeout
try:
bay = cs.bays.create(**opts)
_show_bay(bay)
# support for non-async in 1.1
if args.magnum_api_version and args.magnum_api_version == '1.1':
_show_bay(bay)
else:
fields = str(bay).split("u'")
uuid = fields[2]
print("Request to create bay %s has been accepted." % uuid[:-3])
except Exception as e:
print("Create for bay %s failed: %s" %
(opts['name'], e))
@ -177,7 +183,10 @@ def do_bay_update(cs, args):
"""Update information about the given bay."""
patch = magnum_utils.args_array_to_patch(args.op, args.attributes[0])
bay = cs.bays.update(args.bay, patch)
_show_bay(bay)
if args.magnum_api_version and args.magnum_api_version == '1.1':
_show_bay(bay)
else:
print("Request to update bay %s has been accepted." % args.bay)
@utils.arg('bay',

View File

@ -110,7 +110,13 @@ def do_cluster_create(cs, args):
opts['create_timeout'] = args.timeout
try:
cluster = cs.clusters.create(**opts)
_show_cluster(cluster)
# support for non-async in 1.1
if args.magnum_api_version and args.magnum_api_version == '1.1':
_show_cluster(cluster)
else:
fields = str(cluster).split("u'")
uuid = fields[2]
print("Request to create cluster %s has been accepted." % uuid[:3])
except Exception as e:
print("Create for cluster %s failed: %s" %
(opts['name'], e))
@ -171,7 +177,10 @@ def do_cluster_update(cs, args):
"""Update information about the given cluster."""
patch = magnum_utils.args_array_to_patch(args.op, args.attributes[0])
cluster = cs.clusters.update(args.cluster, patch)
_show_cluster(cluster)
if args.magnum_api_version and args.magnum_api_version == '1.1':
_show_cluster(cluster)
else:
print("Request to update cluster %s has been accepted." % args.cluster)
@utils.arg('cluster',