From: Frank Brehm Date: Tue, 1 Oct 2019 08:38:46 +0000 (+0200) Subject: Start rewriting lib/cr_tf/handler.py for multiple VSPheres X-Git-Tag: 1.3.4~35 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=b28934ecbb10123e06f21df07611b68c91d08332;p=pixelpark%2Fcreate-terraform.git Start rewriting lib/cr_tf/handler.py for multiple VSPheres --- diff --git a/lib/cr_tf/handler.py b/lib/cr_tf/handler.py index b352448..caff48b 100644 --- a/lib/cr_tf/handler.py +++ b/lib/cr_tf/handler.py @@ -59,7 +59,7 @@ from .terraform.disk import TerraformDisk from .xlate import XLATOR -__version__ = '2.8.9' +__version__ = '2.9.0' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -145,7 +145,7 @@ class CreateTerraformHandler(BaseHandler): terminal_has_colors=False, initialized=False): self.pdns = None - self.vsphere = None + self.vsphere = {} self.config = None self.terraform_cmd = None @@ -283,6 +283,9 @@ class CreateTerraformHandler(BaseHandler): res['stop_at_step'] = self.stop_at_step res['steps'] = copy.copy(self.steps) res['tz_name'] = self.tz_name + res['vsphere'] = {} + for vsphere_name in self.vsphere.keys(): + res['vsphere'][vsphere_name] = self.vsphere[vsphere_name].as_dict(short=short) return res @@ -350,18 +353,18 @@ class CreateTerraformHandler(BaseHandler): except PowerDNSHandlerError as e: raise ExpectedHandlerError(str(e)) - try: - self.vsphere = VsphereServer( - appname=self.appname, verbose=self.verbose, base_dir=self.base_dir, - host=self.config.vsphere_host, port=self.config.vsphere_port, - user=self.config.vsphere_user, password=self.config.vsphere_password, - dc=self.config.vsphere_dc, simulate=self.simulate, force=self.force, - terminal_has_colors=self.terminal_has_colors, initialized=True, - ) - - self.vsphere.get_about() - except VSphereExpectedError as e: - raise ExpectedHandlerError(str(e)) +# try: +# self.vsphere = VsphereServer( +# appname=self.appname, verbose=self.verbose, base_dir=self.base_dir, +# host=self.config.vsphere_host, port=self.config.vsphere_port, +# user=self.config.vsphere_user, password=self.config.vsphere_password, +# dc=self.config.vsphere_dc, simulate=self.simulate, force=self.force, +# terminal_has_colors=self.terminal_has_colors, initialized=True, +# ) +# +# self.vsphere.get_about() +# except VSphereExpectedError as e: +# raise ExpectedHandlerError(str(e)) # ------------------------------------------------------------------------- def check_terraform_version(self):