]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
Fixing init of the VsphereConnection object
authorFrank Brehm <frank@brehm-online.com>
Tue, 19 Jul 2022 11:20:32 +0000 (13:20 +0200)
committerFrank Brehm <frank@brehm-online.com>
Tue, 19 Jul 2022 11:20:32 +0000 (13:20 +0200)
lib/cr_tf/__init__.py
lib/cr_tf/handler.py

index 7e5dea76b3f3d75ae1c58ab32361fa9c0455333a..e6013e5c1d09f232d5a1b3b476c4296070d0e56b 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/env python3
 # -*- coding: utf-8 -*-
 
-__version__ = '1.6.3'
+__version__ = '1.6.4'
 
 MIN_VERSION_TERRAFORM = '1.0.5'
 MAX_VERSION_TERRAFORM = '1.3.0'
index 05d5ab4d485ac4415a7ef57c5221ecf7bb50f863..fa7631598e76519b15c10a33c3329ce272f2b3ec 100644 (file)
@@ -47,6 +47,7 @@ from fb_tools.handling_obj import HandlingObject, CalledProcessError
 from fb_tools.handler import BaseHandler
 
 from fb_vmware.errors import VSphereExpectedError
+from fb_vmware.config import VSPhereConfigInfo
 from fb_vmware.connect import VsphereConnection
 
 from fb_pdnstools.server import PowerDNSServer
@@ -769,22 +770,27 @@ class CreateTerraformHandler(BaseHandler):
                     'appname': self.appname,
                     'verbose': self.verbose,
                     'base_dir': self.base_dir,
-                    'host': self.config.vsphere[vname].host,
-                    'port': self.config.vsphere[vname].port,
-                    'user': self.vsphere_user,
-                    'password': self.vsphere_password,
-                    'dc': self.config.vsphere[vname].dc,
                     'simulate': self.simulate,
                     'force': self.force,
                     'terminal_has_colors': self.terminal_has_colors,
                     'initialized': True,
                 }
+                show_params = copy.copy(params)
+
+                connect_info = VSPhereConfigInfo(
+                    appname=self.appname, verbose=self.verbose, base_dir=self.base_dir,
+                    host=self.config.vsphere[vname].host, port=self.config.vsphere[vname].port,
+                    dc=self.config.vsphere[vname].dc, user=self.vsphere_user,
+                    password=self.vsphere_password, initialized=True)
+
+                params['connect_info'] = connect_info
+                show_params['connect_info'] = connect_info.as_dict()
+
                 if self.verbose > 1:
-                    params_out = copy.copy(params)
                     if self.verbose < 5:
-                        params_out['password'] = '******'
+                        show_params['connect_info']['password'] = '******'
                     msg = _("Initialising a {}-object with params:").format('VsphereConnection')
-                    msg += '\n' + pp(params_out)
+                    msg += '\n' + pp(show_params)
                     LOG.debug(msg)
 
                 vsphere = VsphereConnection(**params)