diff options
| author | Dean Troyer <dtroyer@gmail.com> | 2019-07-26 16:41:04 -0500 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2019-08-01 14:53:02 -0500 |
| commit | 865e182970c9ce42d5be07cd3b81fb5dd1a3e656 (patch) | |
| tree | 7465ddd3b1837d8e597c20033f2be478a56d9bc4 /openstackclient/common | |
| parent | c4743199096e77bdc89423dc37f632ac24acdba1 (diff) | |
| download | python-openstackclient-865e182970c9ce42d5be07cd3b81fb5dd1a3e656.tar.gz | |
Make configuration show not require auth
The configuration show should not require auth to just display the
OSC config object. Changes to make it not require auth have
knock-on effects of needing to change a bunch of tests that use it
assuming it _does_ require auth so change those to use 'extension list'
instead.
This sets up further testing of the command line options for changes
in behaviour when we switch to straight SDK usage for configuration.
Change-Id: I6c52485341214ba401064c0f2d1e2b95fdc225c0
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
Diffstat (limited to 'openstackclient/common')
| -rw-r--r-- | openstackclient/common/configuration.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/openstackclient/common/configuration.py b/openstackclient/common/configuration.py index 57825bb0..53b30d5f 100644 --- a/openstackclient/common/configuration.py +++ b/openstackclient/common/configuration.py @@ -25,6 +25,8 @@ REDACTED = "<redacted>" class ShowConfiguration(command.ShowOne): _description = _("Display configuration details") + auth_required = False + def get_parser(self, prog_name): parser = super(ShowConfiguration, self).get_parser(prog_name) mask_group = parser.add_mutually_exclusive_group() @@ -45,13 +47,21 @@ class ShowConfiguration(command.ShowOne): def take_action(self, parsed_args): - auth_plg_name = self.app.client_manager.auth_plugin_name - secret_opts = [o.dest for o in base.get_plugin_options(auth_plg_name) - if o.secret] - info = self.app.client_manager.get_configuration() + + # Assume a default secret list in case we do not have an auth_plugin + secret_opts = ["password", "token"] + + if getattr(self.app.client_manager, "auth_plugin_name", None): + auth_plg_name = self.app.client_manager.auth_plugin_name + secret_opts = [ + o.dest for o in base.get_plugin_options(auth_plg_name) + if o.secret + ] + for key, value in six.iteritems(info.pop('auth', {})): if parsed_args.mask and key.lower() in secret_opts: - value = REDACTED + value = REDACTED info['auth.' + key] = value + return zip(*sorted(six.iteritems(info))) |
