From 097f0d9be41974731dad434ed506113c3dbd932e Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 18 Feb 2020 20:33:12 -0500 Subject: [PATCH] Fix bug with script load from database --- api-daemon/pvcapid/provisioner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api-daemon/pvcapid/provisioner.py b/api-daemon/pvcapid/provisioner.py index 9f2e6074..43c12c8c 100755 --- a/api-daemon/pvcapid/provisioner.py +++ b/api-daemon/pvcapid/provisioner.py @@ -1090,7 +1090,11 @@ def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True): query = 'SELECT script FROM script WHERE id = %s' args = (profile_data['script'],) db_cur.execute(query, args) - vm_data['script'] = db_cur.fetchone() + db_row = db_cur.fetchone() + if db_row: + vm_data['script'] = db_row.get('script') + else: + vm_data['script'] = None if vm_data['script'] and not is_ova_install: is_script_install = True