Add configuration show command

Create a `configuration show` command that displays the current
configuration of the CLI.  Different configurations can be
displayed using options such as --os-cloud.  Passwords and
tokens are redacted by default unless the --unmask
option is specified.

Closes-Bug: #1476729

Change-Id: I0792365d0c5fa526cd09c0ed88c6bb1e2cb813a7
This commit is contained in:
TerryHowe 2015-07-19 12:15:04 -06:00
parent 8a72d4538d
commit b53e8a0801
3 changed files with 17 additions and 0 deletions

View File

@ -15,6 +15,7 @@
"""Manage access to the clients, including authenticating when needed."""
import copy
import logging
import pkg_resources
import sys
@ -203,6 +204,9 @@ class ClientManager(object):
interface=interface)
return endpoint
def get_configuration(self):
return copy.deepcopy(self._cli_options.config)
# Plugin Support

View File

@ -28,6 +28,7 @@ PASSWORD = "scratchy"
PROJECT_NAME = "poochie"
REGION_NAME = "richie"
INTERFACE = "catchy"
VERSION = "3"
TEST_RESPONSE_DICT = fixture.V2Token(token_id=AUTH_TOKEN,
user_name=USERNAME)
@ -102,6 +103,17 @@ class FakeClientManager(object):
self.auth_ref = None
self.auth_plugin_name = None
def get_configuration(self):
return {
'auth': {
'username': USERNAME,
'password': PASSWORD,
'token': AUTH_TOKEN,
},
'region': REGION_NAME,
'identity_api_version': VERSION,
}
class FakeModule(object):
def __init__(self, name, version):

View File

@ -44,6 +44,7 @@ openstack.cli.base =
volume = openstackclient.volume.client
openstack.common =
configuration_show = openstackclient.common.configuration:ShowConfiguration
extension_list = openstackclient.common.extension:ListExtension
limits_show = openstackclient.common.limits:ShowLimits
quota_set = openstackclient.common.quota:SetQuota