Make this even nicer

This commit is contained in:
Joshua Boniface 2019-12-19 13:29:15 -05:00
parent 7901ffb5e3
commit 2fe808f812
2 changed files with 24 additions and 6 deletions

View File

@ -165,7 +165,7 @@ def getInformationFromXML(zk_conn, uuid):
domain_failedreason = zkhandler.readdata(zk_conn, '/domains/{}/failedreason'.format(uuid)) domain_failedreason = zkhandler.readdata(zk_conn, '/domains/{}/failedreason'.format(uuid))
try: try:
domain_node_limit = zkhandler.readdata(zk_conn, '/domains/{}/node_limit'.format(uuid)).split(',') domain_node_limit = zkhandler.readdata(zk_conn, '/domains/{}/node_limit'.format(uuid))
except: except:
domain_node_limit = None domain_node_limit = None
try: try:
@ -178,9 +178,12 @@ def getInformationFromXML(zk_conn, uuid):
domain_node_autostart = None domain_node_autostart = None
if not domain_node_limit: if not domain_node_limit:
domain_node_limit = 'False' domain_node_limit = None
else:
domain_node_limit = domain_node_limit.split(',')
if not domain_node_autostart: if not domain_node_autostart:
domain_node_autostart = 'False' domain_node_autostart = None
try: try:
domain_profile = zkhandler.readdata(zk_conn, '/domains/{}/profile'.format(uuid)) domain_profile = zkhandler.readdata(zk_conn, '/domains/{}/profile'.format(uuid))

View File

@ -749,9 +749,24 @@ def format_info(zk_conn, domain_information, long_output):
ainformation.append('') ainformation.append('')
ainformation.append('{}Failure reason:{} {}'.format(ansiprint.purple(), ansiprint.end(), domain_information['failed_reason'])) ainformation.append('{}Failure reason:{} {}'.format(ansiprint.purple(), ansiprint.end(), domain_information['failed_reason']))
ainformation.append('{}Migration selector:{} {}'.format(ansiprint.purple(), ansiprint.end(), domain_information['node_selector'])) if not domain_information['node_selector']:
ainformation.append('{}Node limit:{} {}'.format(ansiprint.purple(), ansiprint.end(), ', '.join(domain_information['node_limit']))) formatted_node_selector = "False"
ainformation.append('{}Autostart:{} {}'.format(ansiprint.purple(), ansiprint.end(), domain_information['node_autostart'])) else:
formatted_node_selector = domain_information['node_selector']
if not domain_information['node_limit']:
formatted_node_limit = "False"
else:
formatted_node_limit = ', '.join(domain_information['node_limit'])
if not domain_information['node_autostart']:
formatted_node_autostart = "False"
else:
formatted_node_autostart = domain_information['node_autostart']
ainformation.append('{}Migration selector:{} {}'.format(ansiprint.purple(), ansiprint.end(), formatted_node_selector))
ainformation.append('{}Node limit:{} {}'.format(ansiprint.purple(), ansiprint.end(), formatted_node_limit))
ainformation.append('{}Autostart:{} {}'.format(ansiprint.purple(), ansiprint.end(), formatted_node_autostart))
# Network list # Network list
net_list = [] net_list = []