summaryrefslogtreecommitdiff
path: root/openstackclient/common/clientmanager.py
diff options
context:
space:
mode:
authorStephen Finucane <sfinucan@redhat.com>2023-05-08 11:35:45 +0100
committerStephen Finucane <sfinucan@redhat.com>2023-05-10 10:51:30 +0100
commit7d80f9e9626d14ce2ab60e4b69e3ccd070f31e0d (patch)
tree6498649965c44537669d58b2167b56612cd1490b /openstackclient/common/clientmanager.py
parent7ca43885c26d9dd7903e7015c0a31f3486730eea (diff)
downloadpython-openstackclient-7d80f9e9626d14ce2ab60e4b69e3ccd070f31e0d.tar.gz
Blacken openstack.common
Black used with the '-l 79 -S' flags. A future change will ignore this commit in git-blame history by adding a 'git-blame-ignore-revs' file. Change-Id: Ifcb3c798666d74d596b8ecb3d6d507f782de7ba5 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'openstackclient/common/clientmanager.py')
-rw-r--r--openstackclient/common/clientmanager.py34
1 files changed, 21 insertions, 13 deletions
diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py
index 1ed6aa24..35c79247 100644
--- a/openstackclient/common/clientmanager.py
+++ b/openstackclient/common/clientmanager.py
@@ -77,18 +77,20 @@ class ClientManager(clientmanager.ClientManager):
# CloudConfig.__init__() and we'll die if it was not
# passed.
if (
- self._auth_required and
- self._cli_options._openstack_config is not None
+ self._auth_required
+ and self._cli_options._openstack_config is not None
):
- self._cli_options._openstack_config._pw_callback = \
+ self._cli_options._openstack_config._pw_callback = (
shell.prompt_for_password
+ )
try:
# We might already get auth from SDK caching
if not self._cli_options._auth:
- self._cli_options._auth = \
+ self._cli_options._auth = (
self._cli_options._openstack_config.load_auth_plugin(
self._cli_options.config,
)
+ )
except TypeError as e:
self._fallback_load_auth_plugin(e)
@@ -101,14 +103,14 @@ class ClientManager(clientmanager.ClientManager):
# We know it looks ugly, but it's necessary.
if self._cli_options.config['auth']['token'] == 'x':
# restore original auth_type
- self._cli_options.config['auth_type'] = \
- self._original_auth_type
+ self._cli_options.config['auth_type'] = self._original_auth_type
del self._cli_options.config['auth']['token']
del self._cli_options.config['auth']['endpoint']
- self._cli_options._auth = \
+ self._cli_options._auth = (
self._cli_options._openstack_config.load_auth_plugin(
self._cli_options.config,
)
+ )
else:
raise e
@@ -132,8 +134,10 @@ class ClientManager(clientmanager.ClientManager):
# name so we need to figure out which version to look
# for when calling is_service_available()
volume_version = volume_client.api_version.ver_major
- if self.is_service_available(
- "volumev%s" % volume_version) is not False:
+ if (
+ self.is_service_available("volumev%s" % volume_version)
+ is not False
+ ):
return True
elif self.is_service_available('volume') is not False:
return True
@@ -143,6 +147,7 @@ class ClientManager(clientmanager.ClientManager):
# Plugin Support
+
def get_plugin_modules(group):
"""Find plugin entry points"""
mod_list = []
@@ -165,7 +170,8 @@ def get_plugin_modules(group):
module = importlib.import_module(module_name)
except Exception as err:
sys.stderr.write(
- "WARNING: Failed to import plugin %s: %s.\n" % (ep.name, err))
+ "WARNING: Failed to import plugin %s: %s.\n" % (ep.name, err)
+ )
continue
mod_list.append(module)
@@ -198,6 +204,8 @@ PLUGIN_MODULES = get_plugin_modules(
'openstack.cli.base',
)
# Append list of external plugin modules
-PLUGIN_MODULES.extend(get_plugin_modules(
- 'openstack.cli.extension',
-))
+PLUGIN_MODULES.extend(
+ get_plugin_modules(
+ 'openstack.cli.extension',
+ )
+)