Don't strip single-element lists

This was a dumb decision that complicated handling of single-item
entries.
This commit is contained in:
2020-12-01 03:20:00 -05:00
parent 3a5955b41c
commit 185615e6e8
5 changed files with 0 additions and 71 deletions

View File

@ -300,9 +300,6 @@ def format_list_osd(osd_list):
# Handle empty list
if not osd_list:
osd_list = list()
# Handle single-item list
if not isinstance(osd_list, list):
osd_list = [osd_list]
osd_list_output = []
@ -628,9 +625,6 @@ def format_list_pool(pool_list):
# Handle empty list
if not pool_list:
pool_list = list()
# Handle single-entry list
if not isinstance(pool_list, list):
pool_list = [pool_list]
pool_list_output = []
@ -989,9 +983,6 @@ def format_list_volume(volume_list):
# Handle empty list
if not volume_list:
volume_list = list()
# Handle single-entry list
if not isinstance(volume_list, list):
volume_list = [volume_list]
volume_list_output = []
@ -1209,9 +1200,6 @@ def format_list_snapshot(snapshot_list):
# Handle empty list
if not snapshot_list:
snapshot_list = list()
# Handle single-entry list
if not isinstance(snapshot_list, list):
snapshot_list = [snapshot_list]
snapshot_list_output = []

View File

@ -440,10 +440,6 @@ def format_list(config, network_list):
if not network_list:
return "No network found"
# Handle single-element lists
if not isinstance(network_list, list):
network_list = [network_list]
network_list_output = []
# Determine optimal column widths
@ -617,9 +613,6 @@ def format_list_acl(acl_list):
# Handle when we get an empty entry
if not acl_list:
acl_list = list()
# Handle when we get a single entry
if isinstance(acl_list, dict):
acl_list = [acl_list]
acl_list_output = []

View File

@ -186,10 +186,6 @@ def format_info(node_information, long_output):
def format_list(node_list, raw):
# Handle single-element lists
if not isinstance(node_list, list):
node_list = [node_list]
if raw:
ainformation = list()
for node in sorted(item['name'] for item in node_list):

View File

@ -1211,10 +1211,6 @@ def format_info(config, domain_information, long_output):
def format_list(config, vm_list, raw):
# Handle single-element lists
if not isinstance(vm_list, list):
vm_list = [vm_list]
# Function to strip the "br" off of nets and return a nicer list
def getNiceNetID(domain_information):
# Network list