Fixing ignored value of --config parameter in tempest account-generator

Config parameter of tempest account-generator was ignored.
Instead of that default location of config file were used.

If tempest.conf file doesn't exist on default location
then command was failing.
It never used the config file value from command line.
Command was running successfully only when running from tempest
directory or tempest.conf exist in current directory

Test cases from below patches are relevant for this patch:
1.) https://review.openstack.org/#/c/608878
    *test_account_generator_no_config_file*

2.) https://review.openstack.org/#/c/620920
    *test_account_generator_exist_config_file*

Partially-Implements: blueprint tempest-cli-unit-test-coverage

Change-Id: Ic8dcaff920e5cdfb9a9457ff3a3137c225622409
Closes-Bug: #1766354
This commit is contained in:
Manik Bindlish 2018-06-25 06:22:31 +00:00
parent c9eb94f56e
commit 3e99c04329
1 changed files with 6 additions and 3 deletions

View File

@ -293,13 +293,16 @@ class TempestAccountGenerator(command.Command):
def main(opts=None):
setup_logging()
log_warning = False
if not opts:
LOG.warning("Use of: 'tempest-account-generator' is deprecated, "
"please use: 'tempest account-generator'")
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'")
if opts.os_tenant_name:
LOG.warning("'os-tenant-name' and 'OS_TENANT_NAME' are both "
"deprecated, please use 'os-project-name' or "