From 02a4a14ee566a1fbce3eb167a38c7766114d56fc Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 24 Oct 2018 12:44:23 +0200 Subject: [PATCH] Made cluster to a property of the CrTplHandler class --- lib/cr_vmware_tpl/handler.py | 9 ++++++--- python_fb_tools | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/cr_vmware_tpl/handler.py b/lib/cr_vmware_tpl/handler.py index 2c7598e..399c670 100644 --- a/lib/cr_vmware_tpl/handler.py +++ b/lib/cr_vmware_tpl/handler.py @@ -114,6 +114,7 @@ class CrTplHandler(BaseHandler): dc=self.config.dc, cluster=self.config.vsphere_cluster, auto_close=True, simulate=self.simulate, force=self.force, terminal_has_colors=self.terminal_has_colors, initialized=False) + self.cluster = None if initialized: self.initialized = True @@ -135,6 +136,8 @@ class CrTplHandler(BaseHandler): try: retval = self.run() finally: + # Aufräumen ... + self.cluster = None LOG.debug("Closing ...") self.vsphere.disconnect() self.vsphere = None @@ -148,9 +151,9 @@ class CrTplHandler(BaseHandler): self.vsphere.get_about() self.vsphere.get_clusters() - cluster = self.vsphere.get_cluster_by_name(self.config.vsphere_cluster) - if cluster: - LOG.debug("Found VSphere cluster {!r}.".format(cluster.name)) + self.cluster = self.vsphere.get_cluster_by_name(self.config.vsphere_cluster) + if self.cluster: + LOG.debug("Found VSphere cluster {!r}.".format(self.cluster.name)) else: LOG.error("Could not find VSphere cluster {!r}.".format(self.config.vsphere_cluster)) return 6 diff --git a/python_fb_tools b/python_fb_tools index 01981d4..1a34235 160000 --- a/python_fb_tools +++ b/python_fb_tools @@ -1 +1 @@ -Subproject commit 01981d48e153607edd4f4d17e1388cc4b8419fa7 +Subproject commit 1a34235b15900c1fdeb5e3550c820ccfe2c16455 -- 2.39.5