]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
Changing the way of asking for passwords
authorFrank Brehm <frank.brehm@pixelpark.com>
Fri, 3 Sep 2021 16:20:09 +0000 (18:20 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Fri, 3 Sep 2021 16:20:09 +0000 (18:20 +0200)
lib/cr_tf/app.py
lib/cr_tf/handler.py

index c1a47555f647b84877f1d83dc6d3676d3e644bdf..7836f8e4a86cdc3fcbbc2027519c1806ba2b1b28 100644 (file)
@@ -45,7 +45,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.5'
+__version__ = '1.1.6'
 LOG = logging.getLogger(__name__)
 
 SIGNAL_NAMES = {
@@ -326,6 +326,9 @@ class CrTfApplication(BaseApplication):
             simulate=self.simulate, force=self.force, config=self.config,
             terminal_has_colors=self.terminal_has_colors)
 
+        self.handler.get_secret = self.get_secret
+        self.handler.exit = self.exit
+
         if self.args.stop_after:
             self.handler.stop_at_step = self.args.stop_after
 
index 8eb0971b6f885d08f57e43483b1a89cc0b740f09..2cdabda3da1594b62ba2d4013ee64847a409e687 100644 (file)
@@ -67,7 +67,7 @@ from .terraform.disk import TerraformDisk
 
 from .xlate import XLATOR
 
-__version__ = '3.5.2'
+__version__ = '3.5.3'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
@@ -415,16 +415,6 @@ class CreateTerraformHandler(BaseHandler):
             raise CommandNotFoundError('terraform')
         self.check_terraform_version()
 
-        pdns_api_key = self.config.pdns_api_key
-        if not pdns_api_key:
-            msg = '\n' + _("Please input the {}:").format(self.colored(
-                'PowerDNS API key', 'AQUA'))
-            print(msg)
-            pdns_api_key = password_input(prompt='Key: ')
-            if pdns_api_key == '':
-                msg = _("No {} given.").format('PowerDNS API key')
-                raise ExpectedHandlerError(msg)
-
         self.pdns = PowerDNSServer(
             appname=self.appname, verbose=self.verbose, base_dir=self.base_dir,
             master_server=self.config.pdns_master_server,
@@ -760,13 +750,10 @@ class CreateTerraformHandler(BaseHandler):
                     raise ExpectedHandlerError(msg)
 
             if not vsphere_password:
-                msg = '\n' + _("Please input the {}:").format(self.colored(
-                        _('vSphere user password'), 'AQUA'))
-                print(msg)
-                vsphere_password = password_input(prompt=(_('vSphere user name') + ': '))
-                if vsphere_password == '':
-                    msg = _("No {} given.").format(_('vSphere user password'))
-                    raise ExpectedHandlerError(msg)
+                prompt = _("User password")
+                item = _('Password for user {u!r} of vSphere {n} on {h!r}').format(
+                        u=vsphere_user, n=vname, h=self.config.vsphere[vname].host)
+                vsphere_password = self.get_secret(prompt=prompt, item_name=item)
 
             try:
                 params = {