diff options
| author | Zuul <zuul@review.opendev.org> | 2019-08-09 17:29:40 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2019-08-09 17:29:40 +0000 |
| commit | 9042668da4fc70d85e60c79986ab46b0ec070a86 (patch) | |
| tree | 3dee8ea94a547ba505b2f64f96d1f3887d8406ba /openstackclient/common/configuration.py | |
| parent | 6f60f833e87979a1fca066c352dbaf9bb9fd852d (diff) | |
| parent | 865e182970c9ce42d5be07cd3b81fb5dd1a3e656 (diff) | |
| download | python-openstackclient-9042668da4fc70d85e60c79986ab46b0ec070a86.tar.gz | |
Merge "Make configuration show not require auth"
Diffstat (limited to 'openstackclient/common/configuration.py')
| -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))) |
