From ddcd4f44acf1af45285ad0b485e4afec35f1f5dc Mon Sep 17 00:00:00 2001 From: Soniya Vyas Date: Tue, 24 Dec 2019 17:55:34 +0530 Subject: [PATCH] Remove the deprecated tempest-account-generator CLI Tempest CLI tempest-account-generator was deprecated 4 years ago. devstack still uses the deprecated CLI for which patch has been proposed. As deprecation is done long time back, 'tempest-account-generator' should be now used as 'tempest account-generator' The following commit gives the idea of deprecation message:- https://opendev.org/openstack/tempest/commit/68b8b9d26fae5c07fa7c4c443e4b0ca51ad98258 Depends-on: I624e1dc57a3d3533322fb298c01f70241d0400ed Signed-off by: Soniya Vyas Change-Id: I7c18998dd877d7fd065e4d1d0950b6f6413587c3 --- .../account_generator-6eb03f664a448c35.yaml | 7 +++ setup.cfg | 1 - tempest/cmd/account_generator.py | 54 +++++-------------- 3 files changed, 21 insertions(+), 41 deletions(-) create mode 100644 releasenotes/notes/account_generator-6eb03f664a448c35.yaml diff --git a/releasenotes/notes/account_generator-6eb03f664a448c35.yaml b/releasenotes/notes/account_generator-6eb03f664a448c35.yaml new file mode 100644 index 0000000000..ade632f566 --- /dev/null +++ b/releasenotes/notes/account_generator-6eb03f664a448c35.yaml @@ -0,0 +1,7 @@ +--- +upgrade: + - | + Remove the deprecated CLI ``tempest-account-generator`` in favor of + ``tempest account-generator`` command. + You can use ``tempest account-generator`` CLI to generate the accounts + yaml file. diff --git a/setup.cfg b/setup.cfg index d246c68d16..9b5e835f07 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,7 +28,6 @@ data_files = [entry_points] console_scripts = - tempest-account-generator = tempest.cmd.account_generator:main tempest = tempest.cmd.main:main skip-tracker = tempest.lib.cmd.skip_tracker:main check-uuid = tempest.lib.cmd.check_uuid:run diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py index 1535786465..b2306154c3 100755 --- a/tempest/cmd/account_generator.py +++ b/tempest/cmd/account_generator.py @@ -96,7 +96,7 @@ Optional Arguments To see help on specific argument, please do: ``tempest account-generator [OPTIONS] -h``. """ -import argparse + import os import traceback @@ -248,21 +248,6 @@ def _parser_add_args(parser): help='Output accounts yaml file') -def get_options(): - usage_string = ('tempest account-generator [-h] ...\n\n' - 'To see help on specific argument, do:\n' - 'tempest account-generator -h') - parser = argparse.ArgumentParser( - description=DESCRIPTION, - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - usage=usage_string - ) - - _parser_add_args(parser) - opts = parser.parse_args() - return opts - - class TempestAccountGenerator(command.Command): def get_parser(self, prog_name): @@ -272,7 +257,19 @@ class TempestAccountGenerator(command.Command): def take_action(self, parsed_args): try: - main(parsed_args) + if parsed_args.config_file: + config.CONF.set_config_path(parsed_args.config_file) + setup_logging() + resources = [] + for count in range(parsed_args.concurrency): + # Use N different cred_providers to obtain different + # sets of creds + cred_provider = get_credential_provider(parsed_args) + resources.extend(generate_resources(cred_provider, + parsed_args.admin)) + dump_accounts(resources, parsed_args.identity_version, + parsed_args.accounts) + except Exception: LOG.exception("Failure generating test accounts.") traceback.print_exc() @@ -280,26 +277,3 @@ class TempestAccountGenerator(command.Command): def get_description(self): return DESCRIPTION - - -def main(opts=None): - log_warning = False - if not opts: - log_warning = True - opts = get_options() - if opts.config_file: - config.CONF.set_config_path(opts.config_file) - setup_logging() - if log_warning: - LOG.warning("Use of: 'tempest-account-generator' is deprecated, " - "please use: 'tempest account-generator'") - resources = [] - for count in range(opts.concurrency): - # Use N different cred_providers to obtain different sets of creds - cred_provider = get_credential_provider(opts) - resources.extend(generate_resources(cred_provider, opts.admin)) - dump_accounts(resources, opts.identity_version, opts.accounts) - - -if __name__ == "__main__": - main()