From 641f13bb95e36a5146574f6e838417c1b00d3c6f Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 9 Jan 2020 13:19:23 -0500 Subject: [PATCH] Let provisioning finish if script fails This will allow cleanup to succeed even if the provisioning script fails, avoiding leaving the system in a weird state. --- client-api/api_lib/pvcapi_provisioner.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/client-api/api_lib/pvcapi_provisioner.py b/client-api/api_lib/pvcapi_provisioner.py index b2f6fd15..539f565b 100755 --- a/client-api/api_lib/pvcapi_provisioner.py +++ b/client-api/api_lib/pvcapi_provisioner.py @@ -1291,14 +1291,17 @@ def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True): script_arguments[argument_name] = argument_data # Run the script - installer_script.install( - vm_name=vm_name, - vm_id=vm_id, - temporary_directory=temp_dir, - disks=vm_data['volumes'], - networks=vm_data['networks'], - **script_arguments - ) + try: + installer_script.install( + vm_name=vm_name, + vm_id=vm_id, + temporary_directory=temp_dir, + disks=vm_data['volumes'], + networks=vm_data['networks'], + **script_arguments + ) + except: + continue # Phase 9 - install cleanup # * Unmount any mounted volumes