Fixed output of cluster-create in CLI
When running cluster-create, the CLI prints the instances created as part of the output. This causes the results to scroll off the screen and makes it very difficult to see what happened. The output of cluster-create has been consolidated with that of cluster-show, in much the same way as is done with create and show for single instances. Change-Id: Id4eecc236b6c1ec43b47714ac5eabd8323a5b996 Closes-Bug: #1563504
This commit is contained in:
parent
4b2d76931b
commit
e1f5b6f998
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- Fixed CLI output of cluster-create to only print
|
||||
pertinent information so it is consistent with
|
||||
cluster-show. Bug 1563504
|
@ -92,6 +92,23 @@ def _print_instance(instance):
|
||||
utils.print_dict(info)
|
||||
|
||||
|
||||
def _print_cluster(cluster, include_all=False):
|
||||
|
||||
info = cluster._info.copy()
|
||||
info['datastore'] = cluster.datastore['type']
|
||||
info['datastore_version'] = cluster.datastore['version']
|
||||
info['task_name'] = cluster.task['name']
|
||||
info['task_description'] = cluster.task['description']
|
||||
info.pop('task', None)
|
||||
if include_all and hasattr(cluster, 'ip'):
|
||||
info['ip'] = ', '.join(cluster.ip)
|
||||
instances = info.pop('instances', None)
|
||||
if instances:
|
||||
info['instance_count'] = len(instances)
|
||||
info.pop('links', None)
|
||||
utils.print_dict(info)
|
||||
|
||||
|
||||
def _print_object(obj):
|
||||
# Get rid of those ugly links
|
||||
if obj._info.get('links'):
|
||||
@ -267,17 +284,7 @@ def do_show(cs, args):
|
||||
def do_cluster_show(cs, args):
|
||||
"""Shows details of a cluster."""
|
||||
cluster = _find_cluster(cs, args.cluster)
|
||||
info = cluster._info.copy()
|
||||
info['datastore'] = cluster.datastore['type']
|
||||
info['datastore_version'] = cluster.datastore['version']
|
||||
info['task_name'] = cluster.task['name']
|
||||
info['task_description'] = cluster.task['description']
|
||||
del info['task']
|
||||
if hasattr(cluster, 'ip'):
|
||||
info['ip'] = ', '.join(cluster.ip)
|
||||
del info['instances']
|
||||
cluster._info = info
|
||||
_print_object(cluster)
|
||||
_print_cluster(cluster, include_all=True)
|
||||
|
||||
|
||||
@utils.arg('cluster', metavar='<cluster>', help='ID or name of the cluster.')
|
||||
@ -698,13 +705,7 @@ def do_cluster_create(cs, args):
|
||||
args.datastore,
|
||||
args.datastore_version,
|
||||
instances=instances)
|
||||
cluster._info['task_name'] = cluster.task['name']
|
||||
cluster._info['task_description'] = cluster.task['description']
|
||||
del cluster._info['task']
|
||||
cluster._info['datastore'] = cluster.datastore['type']
|
||||
cluster._info['datastore_version'] = cluster.datastore['version']
|
||||
del cluster._info['instances']
|
||||
_print_object(cluster)
|
||||
_print_cluster(cluster)
|
||||
|
||||
|
||||
@utils.arg('instance',
|
||||
|
Loading…
Reference in New Issue
Block a user