Better handle key values
This commit is contained in:
parent
5edcd45ad6
commit
9ea86cc570
|
@ -114,9 +114,7 @@ def format_info(cluster_information, oformat):
|
||||||
ainformation.append('{}Total volumes:{} {}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['volumes']))
|
ainformation.append('{}Total volumes:{} {}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['volumes']))
|
||||||
ainformation.append('{}Total snapshots:{} {}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['snapshots']))
|
ainformation.append('{}Total snapshots:{} {}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['snapshots']))
|
||||||
|
|
||||||
nodes_string = ''
|
nodes_string = '{}Nodes:{} {}/{} {}ready,run{}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['nodes'].get('run,ready', 0), cluster_information['nodes'].get('total', 0), ansiprint.green(), ansiprint.end())
|
||||||
if cluster_information['nodes'].get('run,ready', None):
|
|
||||||
nodes_string += '{}Nodes:{} {}/{} {}ready,run{}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['nodes']['run,ready'], cluster_information['nodes']['total'], ansiprint.green(), ansiprint.end())
|
|
||||||
for state, count in cluster_information['nodes'].items():
|
for state, count in cluster_information['nodes'].items():
|
||||||
if state == 'total' or state == 'run,ready':
|
if state == 'total' or state == 'run,ready':
|
||||||
continue
|
continue
|
||||||
|
@ -126,9 +124,7 @@ def format_info(cluster_information, oformat):
|
||||||
ainformation.append('')
|
ainformation.append('')
|
||||||
ainformation.append(nodes_string)
|
ainformation.append(nodes_string)
|
||||||
|
|
||||||
vms_string = ''
|
vms_string = '{}VMs:{} {}/{} {}start{}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['vms'].get('start', 0), cluster_information['vms'].get('total', 0), ansiprint.green(), ansiprint.end())
|
||||||
if cluster_information['vms'].get('start', None):
|
|
||||||
vms_string += '{}VMs:{} {}/{} {}start{}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['vms']['start'], cluster_information['vms']['total'], ansiprint.green(), ansiprint.end())
|
|
||||||
for state, count in cluster_information['vms'].items():
|
for state, count in cluster_information['vms'].items():
|
||||||
if state == 'total' or state == 'start':
|
if state == 'total' or state == 'start':
|
||||||
continue
|
continue
|
||||||
|
@ -144,7 +140,7 @@ def format_info(cluster_information, oformat):
|
||||||
ainformation.append(vms_string)
|
ainformation.append(vms_string)
|
||||||
|
|
||||||
if cluster_information['osds']['total'] > 0:
|
if cluster_information['osds']['total'] > 0:
|
||||||
osds_string = '{}Ceph OSDs:{} {}/{} {}up,in{}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['osds']['up,in'], cluster_information['osds']['total'], ansiprint.green(), ansiprint.end())
|
osds_string = '{}Ceph OSDs:{} {}/{} {}up,in{}'.format(ansiprint.purple(), ansiprint.end(), cluster_information['osds'].get('up,in', 0), cluster_information['osds'].get('total', 0), ansiprint.green(), ansiprint.end())
|
||||||
for state, count in cluster_information['osds'].items():
|
for state, count in cluster_information['osds'].items():
|
||||||
if state == 'total' or state == 'up,in':
|
if state == 'total' or state == 'up,in':
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue