Don't click.echo except in main program
Return all the strings we printed directly, so that the caller can print them normally.
This commit is contained in:
parent
46f3915ab4
commit
08570bd7b9
|
@ -159,9 +159,12 @@ def ceph_util(config):
|
||||||
return False, response.json()['message']
|
return False, response.json()['message']
|
||||||
|
|
||||||
def format_raw_output(status_data):
|
def format_raw_output(status_data):
|
||||||
click.echo('{bold}Ceph cluster {stype} (primary node {end}{blue}{primary}{end}{bold}){end}\n'.format(bold=ansiprint.bold(), end=ansiprint.end(), blue=ansiprint.blue(), stype=status_data['type'], primary=status_data['primary_node']))
|
ainformation = list()
|
||||||
click.echo(status_data['ceph_data'])
|
ainformation.append('{bold}Ceph cluster {stype} (primary node {end}{blue}{primary}{end}{bold}){end}\n'.format(bold=ansiprint.bold(), end=ansiprint.end(), blue=ansiprint.blue(), stype=status_data['type'], primary=status_data['primary_node']))
|
||||||
click.echo('')
|
ainformation.append(status_data['ceph_data'])
|
||||||
|
ainformation.append('')
|
||||||
|
|
||||||
|
return '\n'.join(ainformation)
|
||||||
|
|
||||||
#
|
#
|
||||||
# OSD functions
|
# OSD functions
|
||||||
|
@ -589,7 +592,7 @@ Wr: {osd_wrops: <{osd_wrops_length}} \
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(osd_list_output)))
|
return '\n'.join(sorted(osd_list_output))
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -900,7 +903,7 @@ Wr: {pool_write_ops: <{pool_write_ops_length}} \
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(pool_list_output)))
|
return '\n'.join(sorted(pool_list_output))
|
||||||
|
|
||||||
#
|
#
|
||||||
# Volume functions
|
# Volume functions
|
||||||
|
@ -1186,7 +1189,7 @@ def format_list_volume(volume_list):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(volume_list_output)))
|
return '\n'.join(sorted(volume_list_output))
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1404,4 +1407,4 @@ def format_list_snapshot(snapshot_list):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(snapshot_list_output)))
|
return '\n'.join(sorted(snapshot_list_output))
|
||||||
|
|
|
@ -156,8 +156,5 @@ def format_info(cluster_information, oformat):
|
||||||
ainformation.append('')
|
ainformation.append('')
|
||||||
ainformation.append(osds_string)
|
ainformation.append(osds_string)
|
||||||
|
|
||||||
information = '\n'.join(ainformation)
|
ainformation.append('')
|
||||||
click.echo(information)
|
return '\n'.join(ainformation)
|
||||||
|
|
||||||
click.echo('')
|
|
||||||
|
|
||||||
|
|
|
@ -483,8 +483,7 @@ def getOutputColours(network_information):
|
||||||
|
|
||||||
def format_info(config, network_information, long_output):
|
def format_info(config, network_information, long_output):
|
||||||
if not network_information:
|
if not network_information:
|
||||||
click.echo("No network found")
|
return "No network found"
|
||||||
return
|
|
||||||
|
|
||||||
v6_flag_colour, v4_flag_colour, dhcp6_flag_colour, dhcp4_flag_colour = getOutputColours(network_information)
|
v6_flag_colour, v4_flag_colour, dhcp6_flag_colour, dhcp4_flag_colour = getOutputColours(network_information)
|
||||||
|
|
||||||
|
@ -513,30 +512,36 @@ def format_info(config, network_information, long_output):
|
||||||
ainformation.append('{}DHCPv4 range:{} {} - {}'.format(ansiprint.purple(), ansiprint.end(), network_information['ip4']['dhcp_start'], network_information['ip4']['dhcp_end']))
|
ainformation.append('{}DHCPv4 range:{} {} - {}'.format(ansiprint.purple(), ansiprint.end(), network_information['ip4']['dhcp_start'], network_information['ip4']['dhcp_end']))
|
||||||
|
|
||||||
if long_output:
|
if long_output:
|
||||||
dhcp4_reservations_list = getNetworkDHCPReservations(zk_conn, vni)
|
retcode, dhcp4_reservations_list = net_dhcp_list(config, network_information['vni'], None)
|
||||||
if dhcp4_reservations_list:
|
if dhcp4_reservations_list:
|
||||||
ainformation.append('')
|
ainformation.append('')
|
||||||
ainformation.append('{}Client DHCPv4 reservations:{}'.format(ansiprint.bold(), ansiprint.end()))
|
ainformation.append('{}Client DHCPv4 reservations:{}'.format(ansiprint.bold(), ansiprint.end()))
|
||||||
ainformation.append('')
|
ainformation.append('')
|
||||||
# Only show static reservations in the detailed information
|
if retcode:
|
||||||
dhcp4_reservations_string = formatDHCPLeaseList(zk_conn, vni, dhcp4_reservations_list, reservations=True)
|
dhcp4_reservations_string = format_list_dhcp(dhcp4_reservations_list)
|
||||||
for line in dhcp4_reservations_string.split('\n'):
|
for line in dhcp4_reservations_string.split('\n'):
|
||||||
ainformation.append(line)
|
ainformation.append(line)
|
||||||
|
else:
|
||||||
|
ainformation.append("No leases found")
|
||||||
|
|
||||||
firewall_rules = zkhandler.listchildren(zk_conn, '/networks/{}/firewall_rules'.format(vni))
|
retcode, firewall_rules_list = net_acl_list(config, network_information['vni'], None, None)
|
||||||
if firewall_rules:
|
if firewall_rules_list:
|
||||||
ainformation.append('')
|
ainformation.append('')
|
||||||
ainformation.append('{}Network firewall rules:{}'.format(ansiprint.bold(), ansiprint.end()))
|
ainformation.append('{}Network firewall rules:{}'.format(ansiprint.bold(), ansiprint.end()))
|
||||||
ainformation.append('')
|
ainformation.append('')
|
||||||
formatted_firewall_rules = get_list_firewall_rules(zk_conn, vni)
|
if retcode:
|
||||||
|
firewall_rules_string = format_list_acl(firewall_rules_list)
|
||||||
|
for line in firewall_rules_string.split('\n'):
|
||||||
|
ainformation.append(line)
|
||||||
|
else:
|
||||||
|
ainformation.append("No ACLs found")
|
||||||
|
|
||||||
# Join it all together
|
# Join it all together
|
||||||
click.echo('\n'.join(ainformation))
|
return '\n'.join(ainformation)
|
||||||
|
|
||||||
def format_list(config, network_list):
|
def format_list(config, network_list):
|
||||||
if not network_list:
|
if not network_list:
|
||||||
click.echo("No network found")
|
return "No network found"
|
||||||
return
|
|
||||||
|
|
||||||
# Handle single-element lists
|
# Handle single-element lists
|
||||||
if not isinstance(network_list, list):
|
if not isinstance(network_list, list):
|
||||||
|
@ -653,7 +658,7 @@ def format_list(config, network_list):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(network_list_output)))
|
return '\n'.join(sorted(network_list_output))
|
||||||
|
|
||||||
def format_list_dhcp(dhcp_lease_list):
|
def format_list_dhcp(dhcp_lease_list):
|
||||||
dhcp_lease_list_output = []
|
dhcp_lease_list_output = []
|
||||||
|
@ -665,15 +670,15 @@ def format_list_dhcp(dhcp_lease_list):
|
||||||
lease_timestamp_length = 13
|
lease_timestamp_length = 13
|
||||||
for dhcp_lease_information in dhcp_lease_list:
|
for dhcp_lease_information in dhcp_lease_list:
|
||||||
# hostname column
|
# hostname column
|
||||||
_lease_hostname_length = len(dhcp_lease_information['hostname']) + 1
|
_lease_hostname_length = len(str(dhcp_lease_information['hostname'])) + 1
|
||||||
if _lease_hostname_length > lease_hostname_length:
|
if _lease_hostname_length > lease_hostname_length:
|
||||||
lease_hostname_length = _lease_hostname_length
|
lease_hostname_length = _lease_hostname_length
|
||||||
# ip4_address column
|
# ip4_address column
|
||||||
_lease_ip4_address_length = len(dhcp_lease_information['ip4_address']) + 1
|
_lease_ip4_address_length = len(str(dhcp_lease_information['ip4_address'])) + 1
|
||||||
if _lease_ip4_address_length > lease_ip4_address_length:
|
if _lease_ip4_address_length > lease_ip4_address_length:
|
||||||
lease_ip4_address_length = _lease_ip4_address_length
|
lease_ip4_address_length = _lease_ip4_address_length
|
||||||
# mac_address column
|
# mac_address column
|
||||||
_lease_mac_address_length = len(dhcp_lease_information['mac_address']) + 1
|
_lease_mac_address_length = len(str(dhcp_lease_information['mac_address'])) + 1
|
||||||
if _lease_mac_address_length > lease_mac_address_length:
|
if _lease_mac_address_length > lease_mac_address_length:
|
||||||
lease_mac_address_length = _lease_mac_address_length
|
lease_mac_address_length = _lease_mac_address_length
|
||||||
|
|
||||||
|
@ -710,14 +715,14 @@ def format_list_dhcp(dhcp_lease_list):
|
||||||
lease_ip4_address_length=lease_ip4_address_length,
|
lease_ip4_address_length=lease_ip4_address_length,
|
||||||
lease_mac_address_length=lease_mac_address_length,
|
lease_mac_address_length=lease_mac_address_length,
|
||||||
lease_timestamp_length=12,
|
lease_timestamp_length=12,
|
||||||
lease_hostname=dhcp_lease_information['hostname'],
|
lease_hostname=str(dhcp_lease_information['hostname']),
|
||||||
lease_ip4_address=dhcp_lease_information['ip4_address'],
|
lease_ip4_address=str(dhcp_lease_information['ip4_address']),
|
||||||
lease_mac_address=dhcp_lease_information['mac_address'],
|
lease_mac_address=str(dhcp_lease_information['mac_address']),
|
||||||
lease_timestamp=dhcp_lease_information['timestamp']
|
lease_timestamp=str(dhcp_lease_information['timestamp'])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(dhcp_lease_list_output)))
|
return '\n'.join(sorted(dhcp_lease_list_output))
|
||||||
|
|
||||||
def format_list_acl(acl_list):
|
def format_list_acl(acl_list):
|
||||||
# Handle when we get an empty entry
|
# Handle when we get an empty entry
|
||||||
|
@ -788,4 +793,4 @@ def format_list_acl(acl_list):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(acl_list_output)))
|
return '\n'.join(sorted(acl_list_output))
|
||||||
|
|
|
@ -208,10 +208,8 @@ def format_info(node_information, long_output):
|
||||||
ainformation.append('{}Allocated RAM (MiB):{} {}'.format(ansiprint.purple(), ansiprint.end(), node_information['memory']['allocated']))
|
ainformation.append('{}Allocated RAM (MiB):{} {}'.format(ansiprint.purple(), ansiprint.end(), node_information['memory']['allocated']))
|
||||||
|
|
||||||
# Join it all together
|
# Join it all together
|
||||||
information = '\n'.join(ainformation)
|
ainformation.append('')
|
||||||
click.echo(information)
|
return '\n'.join(ainformation)
|
||||||
|
|
||||||
click.echo('')
|
|
||||||
|
|
||||||
def format_list(node_list):
|
def format_list(node_list):
|
||||||
# Handle single-element lists
|
# Handle single-element lists
|
||||||
|
@ -354,4 +352,4 @@ Mem (M): {node_mem_total: <{mem_total_length}} {node_mem_used: <{mem_used_length
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(node_list_output)))
|
return '\n'.join(sorted(node_list_output))
|
||||||
|
|
|
@ -673,6 +673,7 @@ def format_list_template(template_data, template_type=None):
|
||||||
"""
|
"""
|
||||||
template_types = [ 'system', 'network', 'storage' ]
|
template_types = [ 'system', 'network', 'storage' ]
|
||||||
normalized_template_data = dict()
|
normalized_template_data = dict()
|
||||||
|
ainformation = list()
|
||||||
|
|
||||||
if template_type in template_types:
|
if template_type in template_types:
|
||||||
template_types = [ template_type ]
|
template_types = [ template_type ]
|
||||||
|
@ -682,23 +683,25 @@ def format_list_template(template_data, template_type=None):
|
||||||
normalized_template_data = template_data
|
normalized_template_data = template_data
|
||||||
|
|
||||||
if 'system' in template_types:
|
if 'system' in template_types:
|
||||||
click.echo('System templates:')
|
ainformation.append('System templates:')
|
||||||
click.echo()
|
ainformation.append('')
|
||||||
format_list_template_system(normalized_template_data['system_templates'])
|
ainformation.append(format_list_template_system(normalized_template_data['system_templates']))
|
||||||
if len(template_types) > 1:
|
if len(template_types) > 1:
|
||||||
click.echo()
|
ainformation.append('')
|
||||||
|
|
||||||
if 'network' in template_types:
|
if 'network' in template_types:
|
||||||
click.echo('Network templates:')
|
ainformation.append('Network templates:')
|
||||||
click.echo()
|
ainformation.append('')
|
||||||
format_list_template_network(normalized_template_data['network_templates'])
|
ainformation.append(format_list_template_network(normalized_template_data['network_templates']))
|
||||||
if len(template_types) > 1:
|
if len(template_types) > 1:
|
||||||
click.echo()
|
ainformation.append('')
|
||||||
|
|
||||||
if 'storage' in template_types:
|
if 'storage' in template_types:
|
||||||
click.echo('Storage templates:')
|
ainformation.append('Storage templates:')
|
||||||
click.echo()
|
ainformation.append('')
|
||||||
format_list_template_storage(normalized_template_data['storage_templates'])
|
ainformation.append(format_list_template_storage(normalized_template_data['storage_templates']))
|
||||||
|
|
||||||
|
return '\n'.join(ainformation)
|
||||||
|
|
||||||
def format_list_template_system(template_data):
|
def format_list_template_system(template_data):
|
||||||
if isinstance(template_data, dict):
|
if isinstance(template_data, dict):
|
||||||
|
@ -836,7 +839,7 @@ Metatemplate: {template_node_limit: <{template_node_limit_length}} \
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join([template_list_output_header] + template_list_output))
|
return '\n'.join([template_list_output_header] + template_list_output)
|
||||||
|
|
||||||
return True, ''
|
return True, ''
|
||||||
|
|
||||||
|
@ -912,9 +915,7 @@ def format_list_template_network(template_template):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join([template_list_output_header] + template_list_output))
|
return '\n'.join([template_list_output_header] + template_list_output)
|
||||||
|
|
||||||
return True, ''
|
|
||||||
|
|
||||||
def format_list_template_storage(template_template):
|
def format_list_template_storage(template_template):
|
||||||
if isinstance(template_template, dict):
|
if isinstance(template_template, dict):
|
||||||
|
@ -1044,9 +1045,7 @@ def format_list_template_storage(template_template):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join([template_list_output_header] + template_list_output))
|
return '\n'.join([template_list_output_header] + template_list_output)
|
||||||
|
|
||||||
return True, ''
|
|
||||||
|
|
||||||
def format_list_userdata(userdata_data, lines=None):
|
def format_list_userdata(userdata_data, lines=None):
|
||||||
if isinstance(userdata_data, dict):
|
if isinstance(userdata_data, dict):
|
||||||
|
@ -1121,9 +1120,7 @@ def format_list_userdata(userdata_data, lines=None):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join([userdata_list_output_header] + userdata_list_output))
|
return '\n'.join([userdata_list_output_header] + userdata_list_output)
|
||||||
|
|
||||||
return True, ''
|
|
||||||
|
|
||||||
def format_list_script(script_data, lines=None):
|
def format_list_script(script_data, lines=None):
|
||||||
if isinstance(script_data, dict):
|
if isinstance(script_data, dict):
|
||||||
|
@ -1198,9 +1195,7 @@ def format_list_script(script_data, lines=None):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join([script_list_output_header] + script_list_output))
|
return '\n'.join([script_list_output_header] + script_list_output)
|
||||||
|
|
||||||
return True, ''
|
|
||||||
|
|
||||||
def format_list_profile(profile_data):
|
def format_list_profile(profile_data):
|
||||||
if isinstance(profile_data, dict):
|
if isinstance(profile_data, dict):
|
||||||
|
@ -1305,7 +1300,4 @@ Data: {profile_userdata: <{profile_userdata_length}} \
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join([profile_list_output_header] + profile_list_output))
|
return '\n'.join([profile_list_output_header] + profile_list_output)
|
||||||
|
|
||||||
return True, ''
|
|
||||||
|
|
||||||
|
|
|
@ -361,8 +361,10 @@ def view_console_log(config, vm, lines=100):
|
||||||
pager = subprocess.Popen(['less', '-R'], stdin=subprocess.PIPE)
|
pager = subprocess.Popen(['less', '-R'], stdin=subprocess.PIPE)
|
||||||
pager.communicate(input=loglines.encode('utf8'))
|
pager.communicate(input=loglines.encode('utf8'))
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
click.echo("Error: `less` pager not found, dumping log ({} lines) to stdout".format(lines))
|
ainformation = list()
|
||||||
return True, loglines
|
ainformation.append("Error: `less` pager not found, dumping log ({} lines) to stdout".format(lines))
|
||||||
|
ainformation.append(loglines)
|
||||||
|
return False, '\n'.join(ainformation)
|
||||||
|
|
||||||
return True, ''
|
return True, ''
|
||||||
|
|
||||||
|
@ -556,10 +558,8 @@ def format_info(config, domain_information, long_output):
|
||||||
ainformation.append(' {0: <3} {1: <14} {2: <8}'.format(domain_information['controllers'].index(controller), controller['type'], controller['model']))
|
ainformation.append(' {0: <3} {1: <14} {2: <8}'.format(domain_information['controllers'].index(controller), controller['type'], controller['model']))
|
||||||
|
|
||||||
# Join it all together
|
# Join it all together
|
||||||
information = '\n'.join(ainformation)
|
ainformation.append('')
|
||||||
click.echo(information)
|
return '\n'.join(ainformation)
|
||||||
|
|
||||||
click.echo('')
|
|
||||||
|
|
||||||
def format_list(config, vm_list, raw):
|
def format_list(config, vm_list, raw):
|
||||||
# Handle single-element lists
|
# Handle single-element lists
|
||||||
|
@ -582,9 +582,10 @@ def format_list(config, vm_list, raw):
|
||||||
|
|
||||||
# Handle raw mode since it just lists the names
|
# Handle raw mode since it just lists the names
|
||||||
if raw:
|
if raw:
|
||||||
|
ainformation = list()
|
||||||
for vm in sorted(item['name'] for item in vm_list):
|
for vm in sorted(item['name'] for item in vm_list):
|
||||||
click.echo(vm)
|
ainformation.append(vm)
|
||||||
return True, ''
|
return '\n'.join(ainformation)
|
||||||
|
|
||||||
vm_list_output = []
|
vm_list_output = []
|
||||||
|
|
||||||
|
@ -717,6 +718,4 @@ def format_list(config, vm_list, raw):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
click.echo('\n'.join(sorted(vm_list_output)))
|
return '\n'.join(sorted(vm_list_output))
|
||||||
|
|
||||||
return True, ''
|
|
||||||
|
|
|
@ -405,8 +405,7 @@ def node_info(node, long_output):
|
||||||
|
|
||||||
retcode, retdata = pvc_node.node_info(config, node)
|
retcode, retdata = pvc_node.node_info(config, node)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_node.format_info(retdata, long_output)
|
retdata = pvc_node.format_info(retdata, long_output)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -423,8 +422,7 @@ def node_list(limit):
|
||||||
|
|
||||||
retcode, retdata = pvc_node.node_list(config, limit)
|
retcode, retdata = pvc_node.node_list(config, limit)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_node.format_list(retdata)
|
retdata = pvc_node.format_list(retdata)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -826,8 +824,7 @@ def vm_info(domain, long_output):
|
||||||
|
|
||||||
retcode, retdata = pvc_vm.vm_info(config, domain)
|
retcode, retdata = pvc_vm.vm_info(config, domain)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_vm.format_info(config, retdata, long_output)
|
retdata = pvc_vm.format_info(config, retdata, long_output)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -880,8 +877,7 @@ def vm_list(target_node, target_state, limit, raw):
|
||||||
|
|
||||||
retcode, retdata = pvc_vm.vm_list(config, limit, target_node, target_state)
|
retcode, retdata = pvc_vm.vm_list(config, limit, target_node, target_state)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_vm.format_list(config, retdata, raw)
|
retdata = pvc_vm.format_list(config, retdata, raw)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1089,8 +1085,7 @@ def net_info(vni, long_output):
|
||||||
|
|
||||||
retcode, retdata = pvc_network.net_info(config, vni)
|
retcode, retdata = pvc_network.net_info(config, vni)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_network.format_info(config, retdata, long_output)
|
retdata = pvc_network.format_info(config, retdata, long_output)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1107,8 +1102,7 @@ def net_list(limit):
|
||||||
|
|
||||||
retcode, retdata = pvc_network.net_list(config, limit)
|
retcode, retdata = pvc_network.net_list(config, limit)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_network.format_list(config, retdata)
|
retdata = pvc_network.format_list(config, retdata)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1186,8 +1180,7 @@ def net_dhcp_list(net, limit, only_static):
|
||||||
|
|
||||||
retcode, retdata = pvc_network.net_dhcp_list(config, net, limit, only_static)
|
retcode, retdata = pvc_network.net_dhcp_list(config, net, limit, only_static)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_network.format_list_dhcp(retdata)
|
retdata = pvc_network.format_list_dhcp(retdata)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1300,8 +1293,7 @@ def net_acl_list(net, limit, direction):
|
||||||
|
|
||||||
retcode, retdata = pvc_network.net_acl_list(config, net, limit, direction)
|
retcode, retdata = pvc_network.net_acl_list(config, net, limit, direction)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_network.format_list_acl(retdata)
|
retdata = pvc_network.format_list_acl(retdata)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1346,8 +1338,7 @@ def ceph_status():
|
||||||
|
|
||||||
retcode, retdata = pvc_ceph.ceph_status(config)
|
retcode, retdata = pvc_ceph.ceph_status(config)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_ceph.format_raw_output(retdata)
|
retdata = pvc_ceph.format_raw_output(retdata)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1361,8 +1352,7 @@ def ceph_util():
|
||||||
|
|
||||||
retcode, retdata = pvc_ceph.ceph_util(config)
|
retcode, retdata = pvc_ceph.ceph_util(config)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_ceph.format_raw_output(retdata)
|
retdata = pvc_ceph.format_raw_output(retdata)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1519,8 +1509,7 @@ def ceph_osd_list(limit):
|
||||||
|
|
||||||
retcode, retdata = pvc_ceph.ceph_osd_list(config, limit)
|
retcode, retdata = pvc_ceph.ceph_osd_list(config, limit)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_ceph.format_list_osd(retdata)
|
retdata = pvc_ceph.format_list_osd(retdata)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1604,8 +1593,7 @@ def ceph_pool_list(limit):
|
||||||
|
|
||||||
retcode, retdata = pvc_ceph.ceph_pool_list(config, limit)
|
retcode, retdata = pvc_ceph.ceph_pool_list(config, limit)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_ceph.format_list_pool(retdata)
|
retdata = pvc_ceph.format_list_pool(retdata)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1749,8 +1737,7 @@ def ceph_volume_list(limit, pool):
|
||||||
|
|
||||||
retcode, retdata = pvc_ceph.ceph_volume_list(config, limit, pool)
|
retcode, retdata = pvc_ceph.ceph_volume_list(config, limit, pool)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_ceph.format_list_volume(retdata)
|
retdata = pvc_ceph.format_list_volume(retdata)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1865,8 +1852,7 @@ def ceph_volume_snapshot_list(pool, volume, limit):
|
||||||
|
|
||||||
retcode, retdata = pvc_ceph.ceph_snapshot_list(config, limit, volume, pool)
|
retcode, retdata = pvc_ceph.ceph_snapshot_list(config, limit, volume, pool)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_ceph.format_list_snapshot(retdata)
|
retdata = pvc_ceph.format_list_snapshot(retdata)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1908,8 +1894,7 @@ def provisioner_template_list(limit):
|
||||||
"""
|
"""
|
||||||
retcode, retdata = pvc_provisioner.template_list(config, limit)
|
retcode, retdata = pvc_provisioner.template_list(config, limit)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_provisioner.format_list_template(retdata)
|
retdata = pvc_provisioner.format_list_template(retdata)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -1937,8 +1922,7 @@ def provisioner_template_system_list(limit):
|
||||||
"""
|
"""
|
||||||
retcode, retdata = pvc_provisioner.template_list(config, limit, template_type='system')
|
retcode, retdata = pvc_provisioner.template_list(config, limit, template_type='system')
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_provisioner.format_list_template(retdata, template_type='system')
|
retdata = pvc_provisioner.format_list_template(retdata, template_type='system')
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2051,8 +2035,7 @@ def provisioner_template_network_list(limit):
|
||||||
"""
|
"""
|
||||||
retcode, retdata = pvc_provisioner.template_list(config, limit, template_type='network')
|
retcode, retdata = pvc_provisioner.template_list(config, limit, template_type='network')
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_provisioner.format_list_template(retdata, template_type='network')
|
retdata = pvc_provisioner.format_list_template(retdata, template_type='network')
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2194,8 +2177,7 @@ def provisioner_template_storage_list(limit):
|
||||||
"""
|
"""
|
||||||
retcode, retdata = pvc_provisioner.template_list(config, limit, template_type='storage')
|
retcode, retdata = pvc_provisioner.template_list(config, limit, template_type='storage')
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_provisioner.format_list_template(retdata, template_type='storage')
|
retdata = pvc_provisioner.format_list_template(retdata, template_type='storage')
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2358,8 +2340,7 @@ def provisioner_userdata_list(limit, full):
|
||||||
lines = 4
|
lines = 4
|
||||||
else:
|
else:
|
||||||
lines = None
|
lines = None
|
||||||
pvc_provisioner.format_list_userdata(retdata, lines)
|
retdata = pvc_provisioner.format_list_userdata(retdata, lines)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2520,8 +2501,7 @@ def provisioner_script_list(limit, full):
|
||||||
lines = 4
|
lines = 4
|
||||||
else:
|
else:
|
||||||
lines = None
|
lines = None
|
||||||
pvc_provisioner.format_list_script(retdata, lines)
|
retdata = pvc_provisioner.format_list_script(retdata, lines)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2673,8 +2653,7 @@ def provisioner_profile_list(limit):
|
||||||
"""
|
"""
|
||||||
retcode, retdata = pvc_provisioner.profile_list(config, limit)
|
retcode, retdata = pvc_provisioner.profile_list(config, limit)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_provisioner.format_list_profile(retdata)
|
retdata = pvc_provisioner.format_list_profile(retdata)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -2873,8 +2852,7 @@ def status_cluster(oformat):
|
||||||
|
|
||||||
retcode, retdata = pvc_cluster.get_info(config)
|
retcode, retdata = pvc_cluster.get_info(config)
|
||||||
if retcode:
|
if retcode:
|
||||||
pvc_cluster.format_info(retdata, oformat)
|
retdata = pvc_cluster.format_info(retdata, oformat)
|
||||||
retdata = ''
|
|
||||||
cleanup(retcode, retdata)
|
cleanup(retcode, retdata)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
Loading…
Reference in New Issue