From: Frank Brehm Date: Wed, 24 Oct 2018 09:34:52 +0000 (+0200) Subject: First actions with VSphere X-Git-Tag: 0.3.2^2~34 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=86a937cea6cd216120186d1cbe2a43be1ef75194;p=pixelpark%2Fcreate-vmware-tpl.git First actions with VSphere --- diff --git a/bin/create-vmware-template b/bin/create-vmware-template index 38e7507..63745de 100755 --- a/bin/create-vmware-template +++ b/bin/create-vmware-template @@ -52,7 +52,7 @@ app.initialized = True if app.verbose > 2: print("{c}-Object:\n{a}".format(c=app.__class__.__name__, a=app)) -# app() +app() sys.exit(0) diff --git a/lib/cr_vmware_tpl/app.py b/lib/cr_vmware_tpl/app.py index e40a050..9171d18 100644 --- a/lib/cr_vmware_tpl/app.py +++ b/lib/cr_vmware_tpl/app.py @@ -391,12 +391,12 @@ class CrTplApplication(BaseApplication): LOG.info("Starting {a!r}, version {v!r} ...".format( a=self.appname, v=self.version)) -# try: -# ret = self.handler() -# self.exit(ret) -# except ExpectedHandlerError as e: -# self.handle_error(str(e), "Temporary VM") -# self.exit(5) + try: + ret = self.handler() + self.exit(ret) + except ExpectedHandlerError as e: + self.handle_error(str(e), "Temporary VM") + self.exit(5) # ============================================================================= diff --git a/lib/cr_vmware_tpl/handler.py b/lib/cr_vmware_tpl/handler.py index 266fbda..1af3631 100644 --- a/lib/cr_vmware_tpl/handler.py +++ b/lib/cr_vmware_tpl/handler.py @@ -131,8 +131,24 @@ class CrTplHandler(BaseHandler): "self.config is not a CrTplConfiguration-instance, but a " "{}-instance instead.").format(self.config.__class__.__name__)) + retval = 0 + try: + retval = self.run() + finally: + LOG.debug("Closing ...") + self.vsphere.disconnect() + self.vsphere = None - return + return retval + + # ------------------------------------------------------------------------- + def run(self): + + LOG.debug("Starting handling ...") + + self.vsphere.get_about() + + return 0 LOG.debug("Connecting to vSphere host {h}:{p} as {u!r} ...".format( diff --git a/python_fb_tools b/python_fb_tools index d542794..ff5009c 160000 --- a/python_fb_tools +++ b/python_fb_tools @@ -1 +1 @@ -Subproject commit d542794caaf1b5336ad451901cbb0b9e6d58b6b2 +Subproject commit ff5009c6121ba6918b3f57f235bbd41091e6710d