]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Catching VSphereExpectedError in lib/cr_vmware_tpl/handler.py
authorFrank Brehm <frank.brehm@pixelpark.com>
Thu, 7 Feb 2019 09:42:27 +0000 (10:42 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Thu, 7 Feb 2019 09:42:27 +0000 (10:42 +0100)
lib/cr_vmware_tpl/handler.py

index 9a21924997ab0d683a44e6d9512680b85234776b..b9d67c621b83766d43d6cd076ad7b741ca3578a6 100644 (file)
@@ -30,12 +30,13 @@ from fb_tools.errors import HandlerError, ExpectedHandlerError
 
 from fb_tools.handler import BaseHandler
 
+from fb_tools.vsphere.errors import VSphereExpectedError
 from fb_tools.vsphere.server import VsphereServer
 from fb_tools.vsphere.iface import VsphereVmInterface
 
 from .config import CrTplConfiguration
 
-__version__ = '1.0.1'
+__version__ = '1.1.0'
 
 LOG = logging.getLogger(__name__)
 TZ = pytz.timezone('Europe/Berlin')
@@ -135,6 +136,11 @@ class CrTplHandler(BaseHandler):
 
             retval = self.run()
 
+        except VSphereExpectedError as e:
+            msg = "Got a {n}: {e}".format(n=e.__class__.__name__, e=e)
+            LOG.error(msg)
+            retval = 9
+
         finally:
             # Aufräumen ...
             self.cluster = None