From: Frank Brehm Date: Thu, 7 Feb 2019 09:42:27 +0000 (+0100) Subject: Catching VSphereExpectedError in lib/cr_vmware_tpl/handler.py X-Git-Tag: 1.1.0^2~20 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=efd06340c867f6fa2762805a60b140e2b1f3ec86;p=pixelpark%2Fcreate-vmware-tpl.git Catching VSphereExpectedError in lib/cr_vmware_tpl/handler.py --- diff --git a/lib/cr_vmware_tpl/handler.py b/lib/cr_vmware_tpl/handler.py index 9a21924..b9d67c6 100644 --- a/lib/cr_vmware_tpl/handler.py +++ b/lib/cr_vmware_tpl/handler.py @@ -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