From: Frank Brehm Date: Tue, 19 Jul 2022 11:20:32 +0000 (+0200) Subject: Fixing init of the VsphereConnection object X-Git-Tag: 1.6.8~2^2~5 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=63328110d8374c2aaa62f4511f4b5943e6c919c2;p=pixelpark%2Fcreate-terraform.git Fixing init of the VsphereConnection object --- diff --git a/lib/cr_tf/__init__.py b/lib/cr_tf/__init__.py index 7e5dea7..e6013e5 100644 --- a/lib/cr_tf/__init__.py +++ b/lib/cr_tf/__init__.py @@ -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' diff --git a/lib/cr_tf/handler.py b/lib/cr_tf/handler.py index 05d5ab4..fa76315 100644 --- a/lib/cr_tf/handler.py +++ b/lib/cr_tf/handler.py @@ -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)