Always handle single-instance results
This commit is contained in:
parent
065ba29c84
commit
44753c0609
|
@ -356,7 +356,7 @@ def format_list_osd(osd_list):
|
|||
if not osd_list:
|
||||
osd_list = list()
|
||||
# Handle single-item list
|
||||
if isinstance(osd_list, dict):
|
||||
if not isinstance(osd_list, list):
|
||||
osd_list = [ osd_list ]
|
||||
|
||||
osd_list_output = []
|
||||
|
@ -709,7 +709,7 @@ def format_list_pool(pool_list):
|
|||
if not pool_list:
|
||||
pool_list = list()
|
||||
# Handle single-entry list
|
||||
if isinstance(pool_list, dict):
|
||||
if not isinstance(pool_list, list):
|
||||
pool_list = [ pool_list ]
|
||||
|
||||
pool_list_output = []
|
||||
|
@ -1079,7 +1079,7 @@ def format_list_volume(volume_list):
|
|||
if not volume_list:
|
||||
volume_list = list()
|
||||
# Handle single-entry list
|
||||
if isinstance(volume_list, dict):
|
||||
if not isinstance(volume_list, list):
|
||||
volume_list = [ volume_list ]
|
||||
|
||||
volume_list_output = []
|
||||
|
@ -1338,7 +1338,7 @@ def format_list_snapshot(snapshot_list):
|
|||
if not snapshot_list:
|
||||
snapshot_list = list()
|
||||
# Handle single-entry list
|
||||
if isinstance(snapshot_list, dict):
|
||||
if not isinstance(snapshot_list, list):
|
||||
snapshot_list = [ snapshot_list ]
|
||||
|
||||
snapshot_list_output = []
|
||||
|
|
|
@ -538,6 +538,10 @@ def format_list(config, network_list):
|
|||
click.echo("No network found")
|
||||
return
|
||||
|
||||
# Handle single-element lists
|
||||
if not isinstance(network_list, list):
|
||||
network_list = [ network_list ]
|
||||
|
||||
network_list_output = []
|
||||
|
||||
# Determine optimal column widths
|
||||
|
|
|
@ -214,6 +214,10 @@ def format_info(node_information, long_output):
|
|||
click.echo('')
|
||||
|
||||
def format_list(node_list):
|
||||
# Handle single-element lists
|
||||
if not isinstance(node_list, list):
|
||||
node_list = [ node_list ]
|
||||
|
||||
node_list_output = []
|
||||
|
||||
# Determine optimal column widths
|
||||
|
|
|
@ -448,6 +448,10 @@ def follow_console_log(config, vm, lines=10):
|
|||
# Output display functions
|
||||
#
|
||||
def format_info(config, domain_information, long_output):
|
||||
# Handle single-element lists
|
||||
if not isinstance(domain_information, list):
|
||||
domain_information = [ domain_information ]
|
||||
|
||||
# Format a nice output; do this line-by-line then concat the elements at the end
|
||||
ainformation = []
|
||||
ainformation.append('{}Virtual machine information:{}'.format(ansiprint.bold(), ansiprint.end()))
|
||||
|
|
Loading…
Reference in New Issue