diff options
| author | Jamie Lennox <jamielennox@redhat.com> | 2014-10-31 13:58:39 +0100 |
|---|---|---|
| committer | Jamie Lennox <jamielennox@redhat.com> | 2014-12-10 09:44:57 +1000 |
| commit | b78dc19d9b47f3347a99394ee839c02f5127a986 (patch) | |
| tree | fd078a88403d666bb12538fe0738030ac0d74879 /keystoneclient/auth/base.py | |
| parent | a60978ed73227f6087ddad6a024e0a04255e35c5 (diff) | |
| download | python-keystoneclient-b78dc19d9b47f3347a99394ee839c02f5127a986.tar.gz | |
Take plugin params from ENV rather than default
The way the argparse options were being structured, if there was a
default value set on the option it would use this value as the default
and not check the environment variables.
This is wrong, we expect the environment variables to be used and the
default value to be the final fallback.
Change-Id: Ifbd68c9de329c2e0c70824ba873caa579e8e86d0
Closes-Bug: #1388076
Diffstat (limited to 'keystoneclient/auth/base.py')
| -rw-r--r-- | keystoneclient/auth/base.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/keystoneclient/auth/base.py b/keystoneclient/auth/base.py index 1f4ce29..4c743d9 100644 --- a/keystoneclient/auth/base.py +++ b/keystoneclient/auth/base.py @@ -155,14 +155,12 @@ class BaseAuthPlugin(object): args.append('--os-%s' % o.name) envs.append('OS_%s' % o.name.replace('-', '_').upper()) - default = opt.default - if default is None: - # select the first ENV that is not false-y or return None - env_vars = (os.environ.get(e) for e in envs) - default = six.next(six.moves.filter(None, env_vars), None) + # select the first ENV that is not false-y or return None + env_vars = (os.environ.get(e) for e in envs) + default = six.next(six.moves.filter(None, env_vars), None) parser.add_argument(*args, - default=default, + default=default or opt.default, metavar=opt.metavar, help=opt.help, dest='os_%s' % opt.dest) |
