Ensure single-element templates are lists

Ensures any list-assuming statements later on hold true even when there
is only a single template entry.
This commit is contained in:
Joshua Boniface 2020-02-21 10:50:28 -05:00
parent b438b9b4c2
commit 6ac82d6ce9
1 changed files with 3 additions and 0 deletions

View File

@ -111,6 +111,9 @@ def list_template(limit, table, is_fuzzy=True):
cur.execute(query, args) cur.execute(query, args)
data = cur.fetchall() data = cur.fetchall()
if not isinstance(data, list):
data = [ data ]
if table == 'network_template': if table == 'network_template':
for template_id, template_data in enumerate(data): for template_id, template_data in enumerate(data):
# Fetch list of VNIs from network table # Fetch list of VNIs from network table