From 6ac82d6ce9385f83d1a6e4eb520f59759c5c030c Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 21 Feb 2020 10:50:28 -0500 Subject: [PATCH] Ensure single-element templates are lists Ensures any list-assuming statements later on hold true even when there is only a single template entry. --- api-daemon/pvcapid/provisioner.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api-daemon/pvcapid/provisioner.py b/api-daemon/pvcapid/provisioner.py index fbfa5808..9a2f0347 100755 --- a/api-daemon/pvcapid/provisioner.py +++ b/api-daemon/pvcapid/provisioner.py @@ -111,6 +111,9 @@ def list_template(limit, table, is_fuzzy=True): cur.execute(query, args) data = cur.fetchall() + if not isinstance(data, list): + data = [ data ] + if table == 'network_template': for template_id, template_data in enumerate(data): # Fetch list of VNIs from network table