From 865e182970c9ce42d5be07cd3b81fb5dd1a3e656 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 26 Jul 2019 16:41:04 -0500 Subject: 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 --- openstackclient/common/configuration.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'openstackclient/common') 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 = "" 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))) -- cgit v1.2.1