From acdb2c55639d4ead8216eca8635dbec7181fdbbe Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 1 Oct 2019 10:26:39 +0200 Subject: [PATCH] Modifying lib/cr_tf/app.py for handling multiple VSPheres --- lib/cr_tf/app.py | 60 +----------------------------------------------- 1 file changed, 1 insertion(+), 59 deletions(-) diff --git a/lib/cr_tf/app.py b/lib/cr_tf/app.py index 2425e17..132cfc1 100644 --- a/lib/cr_tf/app.py +++ b/lib/cr_tf/app.py @@ -43,7 +43,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.0.6' +__version__ = '1.1.0' LOG = logging.getLogger(__name__) SIGNAL_NAMES = { @@ -247,12 +247,6 @@ class CrTfApplication(BaseApplication): self.perform_arg_parser_rest() - if not self.config.vsphere_password: - self.config.vsphere_password = self.get_secret( - prompt=_('Password for vSphere host {h!r} and user {u!r}').format( - h=self.config.vsphere_host, u=self.config.vsphere_user), - item_name=_('vSphere password')) - if not self.config.pdns_api_key: url = 'http' if self.config.pdns_api_use_https: @@ -341,19 +335,6 @@ class CrTfApplication(BaseApplication): default_cfg_file = self.base_dir.joinpath('etc').joinpath(self.appname + '.ini') default_cfg_file_rel = Path(os.path.relpath(str(default_cfg_file), str(cur_dir))) - tf_dir = Path(CrTfConfiguration.default_terraform_dir) - if not tf_dir.is_absolute(): - tf_dir = self.base_dir.joinpath(tf_dir).resolve() - tf_dir_rel = Path(os.path.relpath(str(tf_dir), str(cur_dir))) - - self.arg_parser.add_argument( - '-D', '--dir', '--directory', '--terraform_directory', - metavar=_("DIR"), dest="terraform_dir", - help=_( - "The directory, where the terraform project directories should be created. " - "Default: {!r}").format(str(tf_dir_rel)) - ) - steps = list(CreateTerraformHandler.steps[:]) + ['?'] self.arg_parser.add_argument( @@ -370,32 +351,6 @@ class CrTfApplication(BaseApplication): help=_("Configuration file (default: {!r})").format(str(default_cfg_file_rel)) ) - # vSphere options - vmware_group = self.arg_parser.add_argument_group(_('vSphere options')) - - vmware_group.add_argument( - '-H', '--host', dest='vsphere_host', metavar=_("HOST"), - help=_("Remote vSphere host to connect to (Default: {!r}).").format( - CrTfConfiguration.default_vsphere_host) - ) - - vmware_group.add_argument( - '-p', '--port', dest='vsphere_port', type=int, metavar=_("PORT"), - help=_("Port on vSphere host to connect on (Default: {}).").format( - CrTfConfiguration.default_vsphere_port) - ) - - vmware_group.add_argument( - '-U', '--user', dest='vsphere_user', metavar=_("USER"), - help=_("User name to use when connecting to vSphere host (Default: {!r}).").format( - CrTfConfiguration.default_vsphere_user) - ) - - vmware_group.add_argument( - '-P', '--password', dest='vsphere_password', metavar=_("PASSWORD"), - help=_("Password to use when connecting to vSphere host."), - ) - # PowerDNS options pdns_group = self.arg_parser.add_argument_group(_('PowerDNS options')) @@ -449,25 +404,12 @@ class CrTfApplication(BaseApplication): the command line parameters. """ - self.perform_arg_parser_vmware() self.perform_arg_parser_pdns() self.yaml_file = Path(self.args.yaml_file[0]) if not self.yaml_file.is_absolute(): self.yaml_file = self.yaml_file.resolve() - # ------------------------------------------------------------------------- - def perform_arg_parser_vmware(self): - - if self.args.vsphere_host: - self.config.vsphere_host = self.args.vsphere_host - if self.args.vsphere_port: - self.config.vsphere_port = self.args.vsphere_port - if self.args.vsphere_user: - self.config.vsphere_user = self.args.vsphere_user - if self.args.vsphere_password: - self.config.password = self.args.vsphere_password - # ------------------------------------------------------------------------- def perform_arg_parser_pdns(self): -- 2.39.5