From a0ee53fd6627b787587b5193f2271cf41fda5567 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 7 Sep 2021 17:07:14 +0200 Subject: [PATCH] Fixing method verify_vsphere_credentials() --- lib/cr_tf/app.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/cr_tf/app.py b/lib/cr_tf/app.py index 136e629..c4254ba 100644 --- a/lib/cr_tf/app.py +++ b/lib/cr_tf/app.py @@ -47,7 +47,7 @@ from .xlate import __base_dir__ as __xlate_base_dir__ from .xlate import __mo_file__ as __xlate_mo_file__ from .xlate import XLATOR, LOCALE_DIR, DOMAIN -__version__ = '1.1.11' +__version__ = '1.1.12' LOG = logging.getLogger(__name__) SIGNAL_NAMES = { @@ -501,12 +501,15 @@ class CrTfApplication(BaseApplication): if not self.handler: raise TerraformHandlerError(_("No handler object available.")) + need_nl = False + if not self.handler.vsphere_user: + need_nl = True msg = '\n' + _("Please input the {}:").format(self.colored( _('vSphere user name'), 'AQUA')) print(msg) - self.handler.vsphere_user = input(_('vSphere user name') + ': ') + self.handler.vsphere_user = input(_('Name') + ': ') if not self.handler.vsphere_user: msg = _("No {} given.").format(_('vSphere user name')) raise ExpectedHandlerError(msg) @@ -516,12 +519,16 @@ class CrTfApplication(BaseApplication): vs=vname, usr=self.handler.vsphere_user)) # Dirty, but else a change of fb_tools would be necessary (later) self.handler.vsphere[vname]._user = self.handler.vsphere_user + print('') + need_nl = False if not self.handler.vsphere_password: - prompt = _("User password") + if need_nl: + print('') + prompt = self.colored(_("User password"), 'AQUA') item = _('Password for user {u!r} of vSphere {n} on {h!r}').format( - u=vsphere_user, n=vname, h=self.config.vsphere[vname].host) + u=self.handler.vsphere_user, n=vname, h=self.config.vsphere[vname].host) self.handler.vsphere_password = self.get_secret(prompt=prompt, item_name=item) if not self.handler.vsphere_password: msg = _("No {} given.").format(_('password of vSphere user')) @@ -532,6 +539,11 @@ class CrTfApplication(BaseApplication): vs=vname, usr=self.handler.vsphere_user)) # Dirty, but else a change of fb_tools would be necessary (later) self.handler.vsphere[vname]._password = self.handler.vsphere_password + print('') + need_nl = False + + if need_nl: + print('') # ------------------------------------------------------------------------- def post_run(self): -- 2.39.5