diff options
| author | Ondřej Nový <onovy@debian.org> | 2016-12-28 23:46:01 +0100 |
|---|---|---|
| committer | git-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com> | 2016-12-29 04:20:39 +0000 |
| commit | 3172543e69d673e892fff497fd00dca33a1bc990 (patch) | |
| tree | e43f7864643a7f091af279cfcd23d99e60735f58 | |
| parent | 567e2420f1efa52f64cdd66fbd99d97a79e474aa (diff) | |
3.2.1-1 (patches unapplied)import/3.2.1-1debian/stretch
Imported using git-ubuntu import.
Notes
Notes:
* Team upload.
* New upstream release
* Bumped debhelper compat version to 10
* Bump required version of python{,3}-openstacksdk and
python{,3}-saharaclient
| -rw-r--r-- | .gitreview | 1 | ||||
| -rw-r--r-- | debian/changelog | 10 | ||||
| -rw-r--r-- | debian/compat | 2 | ||||
| -rw-r--r-- | debian/control | 14 | ||||
| -rw-r--r-- | openstackclient/common/client_config.py | 35 | ||||
| -rw-r--r-- | openstackclient/common/clientmanager.py | 20 | ||||
| -rw-r--r-- | openstackclient/shell.py | 36 | ||||
| -rw-r--r-- | releasenotes/notes/bug-1619274-e78afd7c12ea2c3d.yaml | 5 | ||||
| -rw-r--r-- | releasenotes/notes/bug-1630822-mask-password-on-debug-20dcdf1c54e84fa1.yaml | 5 | ||||
| -rw-r--r-- | releasenotes/notes/bug-1642301-ad04424c80e8fe50.yaml | 5 | ||||
| -rw-r--r-- | requirements.txt | 2 | ||||
| -rw-r--r-- | test-requirements.txt | 2 | ||||
| -rwxr-xr-x | tools/tox_install.sh | 2 | ||||
| -rw-r--r-- | tox.ini | 2 |
14 files changed, 125 insertions, 16 deletions
@@ -2,3 +2,4 @@ host=review.openstack.org port=29418 project=openstack/python-openstackclient.git +defaultbranch=stable/newton diff --git a/debian/changelog b/debian/changelog index 12216f6..8239426 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +python-openstackclient (3.2.1-1) unstable; urgency=medium + + * Team upload. + * New upstream release + * Bumped debhelper compat version to 10 + * Bump required version of python{,3}-openstacksdk and + python{,3}-saharaclient + + -- Ondřej Nový <onovy@debian.org> Wed, 28 Dec 2016 23:46:01 +0100 + python-openstackclient (3.2.0-2) unstable; urgency=medium [ Ondřej Nový ] diff --git a/debian/compat b/debian/compat index ec63514..f599e28 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -9 +10 diff --git a/debian/control b/debian/control index c0b3cd0..9f76c65 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,7 @@ Priority: optional Maintainer: PKG OpenStack <openstack-devel@lists.alioth.debian.org> Uploaders: gustavo panizzo <gfa@zumbi.com.ar>, Thomas Goirand <zigo@debian.org>, -Build-Depends: debhelper (>= 9), +Build-Depends: debhelper (>= 10), dh-python, openstack-pkg-tools (>= 52~), python-all, @@ -38,7 +38,7 @@ Build-Depends-Indep: python-aodhclient (>= 0.5.0), python-mock (>= 1.3), python-neutronclient (>= 1:5.1.0), python-novaclient (>= 2:2.30.0), - python-openstacksdk (>= 0.9.4), + python-openstacksdk (>= 0.9.5), python-os-client-config (>= 1.13.1), python-osc-lib (>= 1.0.2), python-os-testr (>= 0.7.0), @@ -51,7 +51,7 @@ Build-Depends-Indep: python-aodhclient (>= 0.5.0), python-osprofiler (>= 1.4.0), python-requests (>= 2.10.0), python-requests-mock (>= 1.0), - python-saharaclient (>= 0.16.0), + python-saharaclient (>= 0.18.0), python-senlinclient (>= 0.3.0), python-six (>= 1.9.0), python-stevedore (>= 1.16.0), @@ -77,7 +77,7 @@ Build-Depends-Indep: python-aodhclient (>= 0.5.0), python3-mock (>= 1.3), python3-neutronclient (>= 1:5.1.0), python3-novaclient (>= 2:2.30.0), - python3-openstacksdk (>= 0.9.4), + python3-openstacksdk (>= 0.9.5), python3-os-client-config (>= 1.13.1), python3-os-testr (>= 0.7.0), python3-osc-lib (>= 1.0.2), @@ -89,7 +89,7 @@ Build-Depends-Indep: python-aodhclient (>= 0.5.0), python3-osprofiler (>= 1.4.0), python3-requests (>= 2.10.0), python3-requests-mock (>= 1.0), - python3-saharaclient (>= 0.16.0), + python3-saharaclient (>= 0.18.0), python3-six (>= 1.9.0), python3-stevedore (>= 1.16.0), python3-subunit, @@ -117,7 +117,7 @@ Depends: python-babel (>= 2.3.4), python-keystoneclient (>= 1:2.0.0), python-neutronclient (>= 1:5.1.0), python-novaclient (>= 2:2.30.0), - python-openstacksdk (>= 0.9.4), + python-openstacksdk (>= 0.9.5), python-os-client-config (>= 1.13.1), python-osc-lib (>= 1.0.2), python-oslo.config (>= 1:3.10.0), @@ -156,7 +156,7 @@ Depends: python3-babel (>= 2.3.4), python3-keystoneclient (>= 1:2.0.0), python3-neutronclient (>= 1:5.1.0), python3-novaclient (>= 2:2.30.0), - python3-openstacksdk (>= 0.9.4), + python3-openstacksdk (>= 0.9.5), python3-os-client-config (>= 1.13.1), python3-osc-lib (>= 1.0.2), python3-oslo.config (>= 1:3.10.0), diff --git a/openstackclient/common/client_config.py b/openstackclient/common/client_config.py index 895909e..1ac53f7 100644 --- a/openstackclient/common/client_config.py +++ b/openstackclient/common/client_config.py @@ -16,6 +16,9 @@ import logging from os_client_config import config +from os_client_config import exceptions as occ_exceptions +from oslo_utils import strutils +import six LOG = logging.getLogger(__name__) @@ -148,6 +151,7 @@ class OSC_Config(config.OpenStackConfig): # present, then do not change the behaviour. Otherwise, set the # PROJECT_DOMAIN_ID to 'OS_DEFAULT_DOMAIN' for better usability. if ( + auth_type in ("password", "v3password", "v3totp") and not config['auth'].get('project_domain_id') and not config['auth'].get('project_domain_name') ): @@ -179,9 +183,19 @@ class OSC_Config(config.OpenStackConfig): config = self._auth_v2_ignore_v3(config) config = self._auth_default_domain(config) - LOG.debug("auth_config_hook(): %s" % config) + if LOG.isEnabledFor(logging.DEBUG): + LOG.debug("auth_config_hook(): %s", + strutils.mask_password(six.text_type(config))) return config + def load_auth_plugin(self, config): + """Get auth plugin and validate args""" + + loader = self._get_auth_loader(config) + config = self._validate_auth(config, loader) + auth_plugin = loader.load_from_options(**config['auth']) + return auth_plugin + def _validate_auth_ksc(self, config, cloud, fixed_argparse=None): """Old compatibility hack for OSC, no longer needed/wanted""" return config @@ -192,6 +206,8 @@ class OSC_Config(config.OpenStackConfig): plugin_options = loader.get_options() + msgs = [] + prompt_options = [] for p_opt in plugin_options: # if it's in config, win, move it and kill it from config dict # if it's in config.auth but not in config we're good @@ -202,6 +218,16 @@ class OSC_Config(config.OpenStackConfig): winning_value = self._find_winning_auth_value( p_opt, config['auth']) + # if the plugin tells us that this value is required + # then error if it's doesn't exist now + if not winning_value and p_opt.required: + msgs.append( + 'Missing value {auth_key}' + ' required for auth plugin {plugin}'.format( + auth_key=p_opt.name, plugin=config.get('auth_type'), + ) + ) + # Clean up after ourselves for opt in [p_opt.name] + [o.name for o in p_opt.deprecated]: opt = opt.replace('-', '_') @@ -224,6 +250,13 @@ class OSC_Config(config.OpenStackConfig): p_opt.dest not in config['auth'] and self._pw_callback is not None ): + # Defer these until we know all required opts are present + prompt_options.append(p_opt) + + if msgs: + raise occ_exceptions.OpenStackConfigException('\n'.join(msgs)) + else: + for p_opt in prompt_options: config['auth'][p_opt.dest] = self._pw_callback(p_opt.prompt) return config diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index 57423ae..23c35a3 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -60,6 +60,26 @@ class ClientManager(clientmanager.ClientManager): self._cacert = self.cacert self._insecure = not self.verify + def setup_auth(self): + """Set up authentication""" + + if self._auth_setup_completed: + return + + # NOTE(dtroyer): Validate the auth args; this is protected with 'if' + # because openstack_config is an optional argument to + # CloudConfig.__init__() and we'll die if it was not + # passed. + if self._cli_options._openstack_config is not None: + self._cli_options._openstack_config._pw_callback = \ + shell.prompt_for_password + self._cli_options._auth = \ + self._cli_options._openstack_config.load_auth_plugin( + self._cli_options.config, + ) + + return super(ClientManager, self).setup_auth() + def is_network_endpoint_enabled(self): """Check if the network endpoint is enabled""" diff --git a/openstackclient/shell.py b/openstackclient/shell.py index 26147be..3971b6e 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -140,12 +140,11 @@ class OpenStackShell(shell.OpenStackShell): # First, throw away what has already been done with o-c-c and # use our own. try: - cc = cloud_config.OSC_Config( + self.cloud_config = cloud_config.OSC_Config( override_defaults={ 'interface': None, 'auth_type': self._auth_type, }, - pw_func=shell.prompt_for_password, ) except (IOError, OSError) as e: self.log.critical("Could not read clouds.yaml configuration file") @@ -154,9 +153,13 @@ class OpenStackShell(shell.OpenStackShell): if not self.options.debug: self.options.debug = None - self.cloud = cc.get_one_cloud( + + # NOTE(dtroyer): Need to do this with validate=False to defer the + # auth plugin handling to ClientManager.setup_auth() + self.cloud = self.cloud_config.get_one_cloud( cloud=self.options.cloud, argparse=self.options, + validate=False, ) # Then, re-create the client_manager with the correct arguments @@ -165,6 +168,33 @@ class OpenStackShell(shell.OpenStackShell): api_version=self.api_version, ) + def prepare_to_run_command(self, cmd): + """Set up auth and API versions""" + + # TODO(dtroyer): Move this to osc-lib + # NOTE(dtroyer): If auth is not required for a command, force fake + # token auth so KSA plugins are happy + + kwargs = {} + if not cmd.auth_required: + # Build fake token creds to keep ksa and o-c-c hushed + kwargs['auth_type'] = 'token_endpoint' + kwargs['auth'] = {} + kwargs['auth']['token'] = 'x' + kwargs['auth']['url'] = 'x' + + # Validate auth options + self.cloud = self.cloud_config.get_one_cloud( + cloud=self.options.cloud, + argparse=self.options, + validate=True, + **kwargs + ) + # Push the updated args into ClientManager + self.client_manager._cli_options = self.cloud + + return super(OpenStackShell, self).prepare_to_run_command(cmd) + def main(argv=None): if argv is None: diff --git a/releasenotes/notes/bug-1619274-e78afd7c12ea2c3d.yaml b/releasenotes/notes/bug-1619274-e78afd7c12ea2c3d.yaml new file mode 100644 index 0000000..71ff5b2 --- /dev/null +++ b/releasenotes/notes/bug-1619274-e78afd7c12ea2c3d.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - Skip password prompt when running commands that do not require auth + and user auth values are present except for password. + [Bug `1619274 <https://bugs.launchpad.net/python-openstackclient/+bug/1619274>`_] diff --git a/releasenotes/notes/bug-1630822-mask-password-on-debug-20dcdf1c54e84fa1.yaml b/releasenotes/notes/bug-1630822-mask-password-on-debug-20dcdf1c54e84fa1.yaml new file mode 100644 index 0000000..1edb3a2 --- /dev/null +++ b/releasenotes/notes/bug-1630822-mask-password-on-debug-20dcdf1c54e84fa1.yaml @@ -0,0 +1,5 @@ +--- +security: + - | + Mask passwords when ``--debug`` or ``-vv`` options are used. + [Bug `1630822 <https://bugs.launchpad.net/python-openstackclient/+bug/1630822>`_] diff --git a/releasenotes/notes/bug-1642301-ad04424c80e8fe50.yaml b/releasenotes/notes/bug-1642301-ad04424c80e8fe50.yaml new file mode 100644 index 0000000..0321c44 --- /dev/null +++ b/releasenotes/notes/bug-1642301-ad04424c80e8fe50.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - Fix problem with ``--os-auth-type token_endpoint`` that caused exceptions + when recent os-client-config version 1.23.0 or newer is installed. + [Bug `1642301 <https://bugs.launchpad.net/bugs/1642301>`_] diff --git a/requirements.txt b/requirements.txt index f065346..5d7636d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ six>=1.9.0 # MIT Babel>=2.3.4 # BSD cliff!=1.16.0,!=1.17.0,>=1.15.0 # Apache-2.0 keystoneauth1>=2.10.0 # Apache-2.0 -openstacksdk>=0.9.4 # Apache-2.0 +openstacksdk>=0.9.5 # Apache-2.0 osc-lib>=1.0.2 # Apache-2.0 oslo.i18n>=2.1.0 # Apache-2.0 oslo.utils>=3.16.0 # Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt index 0ff0e22..6a4d3b8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -33,7 +33,7 @@ python-ironic-inspector-client>=1.5.0 # Apache-2.0 python-mistralclient>=2.0.0 # Apache-2.0 python-muranoclient>=0.8.2 # Apache-2.0 python-neutronclient>=5.1.0 # Apache-2.0 -python-saharaclient>=0.16.0 # Apache-2.0 +python-saharaclient>=0.18.0 # Apache-2.0 python-searchlightclient>=0.2.0 #Apache-2.0 python-senlinclient>=0.3.0 # Apache-2.0 python-zaqarclient>=1.0.0 # Apache-2.0 diff --git a/tools/tox_install.sh b/tools/tox_install.sh index 4af3be1..5625151 100755 --- a/tools/tox_install.sh +++ b/tools/tox_install.sh @@ -5,7 +5,7 @@ # the constraints file before applying it for from-source installation. ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner -BRANCH_NAME=master +BRANCH_NAME=stable/newton CLIENT_NAME=python-openstackclient requirements_installed=$(echo "import openstack_requirements" | python 2>/dev/null ; echo $?) @@ -6,7 +6,7 @@ skipdist = True [testenv] usedevelop = True install_command = - {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} + {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/newton} {opts} {packages} setenv = VIRTUAL_ENV={envdir} deps = -r{toxinidir}/test-requirements.txt commands = ostestr {posargs} |
