]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
Start rewriting lib/cr_tf/handler.py for multiple VSPheres
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 1 Oct 2019 08:38:46 +0000 (10:38 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 1 Oct 2019 08:38:46 +0000 (10:38 +0200)
lib/cr_tf/handler.py

index b352448a98647738903fa8210b67cf59991711d2..caff48bb1b1464d32f421f0cc04852cdb6f3fc7c 100644 (file)
@@ -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):