diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-09-08 17:40:13 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-09-08 17:40:13 +0000 |
| commit | 085bc5255d8537cba9aded23e492c11b9d265c8b (patch) | |
| tree | 63a3c783cae92c8ac7d8a16c75541870037a75a2 /openstackclient/common/clientmanager.py | |
| parent | 55378953e2fbcf8c8a25b412e8c8ed45662d202a (diff) | |
| parent | 14dbfe44741b65c9e0514a34669f52de8629b1c0 (diff) | |
| download | python-openstackclient-085bc5255d8537cba9aded23e492c11b9d265c8b.tar.gz | |
Merge "Defer auth prompting until it is actually needed"
Diffstat (limited to 'openstackclient/common/clientmanager.py')
| -rw-r--r-- | openstackclient/common/clientmanager.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index 57423aed..23c35a3b 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""" |
