diff options
| author | ting.wang <ting.wang@easystack.cn> | 2016-02-20 14:28:08 +0800 |
|---|---|---|
| committer | ting.wang <ting.wang@easystack.cn> | 2016-02-21 13:21:31 +0800 |
| commit | e2158b7ef4c307ff5be7bd2ef0ca3044f37759d4 (patch) | |
| tree | f42047689a1b39d5c3bdf078261d7a277fcdbed2 /openstackclient/common | |
| parent | 867bcb0db8742fd2daa5c91dfd3c164ac4178f18 (diff) | |
| download | python-openstackclient-e2158b7ef4c307ff5be7bd2ef0ca3044f37759d4.tar.gz | |
Clean redundant argument to dict.get
`dict.get()` returns `None` by default, if a key wasn't found.
Removing `None` as second argument to avoid redundancy.
Change-Id: Ia82f7469cd019509bbeccbfe54b15eeedc7bb6ea
Diffstat (limited to 'openstackclient/common')
| -rw-r--r-- | openstackclient/common/clientmanager.py | 12 | ||||
| -rw-r--r-- | openstackclient/common/exceptions.py | 4 | ||||
| -rw-r--r-- | openstackclient/common/logs.py | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index 78a0ae6e..fd88bdec 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -90,7 +90,7 @@ class ClientManager(object): self._cli_options = cli_options self._api_version = api_version self._pw_callback = pw_func - self._url = self._cli_options.auth.get('url', None) + self._url = self._cli_options.auth.get('url') self._region_name = self._cli_options.region_name self._interface = self._cli_options.interface @@ -146,7 +146,7 @@ class ClientManager(object): # Horrible hack alert...must handle prompt for null password if # password auth is requested. if (self.auth_plugin_name.endswith('password') and - not self._cli_options.auth.get('password', None)): + not self._cli_options.auth.get('password')): self._cli_options.auth['password'] = self._pw_callback() (auth_plugin, self._auth_params) = auth.build_auth_params( @@ -162,9 +162,9 @@ class ClientManager(object): # PROJECT_DOMAIN_ID to 'OS_DEFAULT_DOMAIN' for better usability. if (self._api_version.get('identity') == '3' and self.auth_plugin_name.endswith('password') and - not self._auth_params.get('project_domain_id', None) and + not self._auth_params.get('project_domain_id') and not self.auth_plugin_name.startswith('v2') and - not self._auth_params.get('project_domain_name', None)): + not self._auth_params.get('project_domain_name')): self._auth_params['project_domain_id'] = default_domain # NOTE(stevemar): If USER_DOMAIN_ID or USER_DOMAIN_NAME is present, @@ -173,8 +173,8 @@ class ClientManager(object): if (self._api_version.get('identity') == '3' and self.auth_plugin_name.endswith('password') and not self.auth_plugin_name.startswith('v2') and - not self._auth_params.get('user_domain_id', None) and - not self._auth_params.get('user_domain_name', None)): + not self._auth_params.get('user_domain_id') and + not self._auth_params.get('user_domain_name')): self._auth_params['user_domain_id'] = default_domain # For compatibility until all clients can be updated diff --git a/openstackclient/common/exceptions.py b/openstackclient/common/exceptions.py index ab043db0..8ec49931 100644 --- a/openstackclient/common/exceptions.py +++ b/openstackclient/common/exceptions.py @@ -122,8 +122,8 @@ def from_response(response, body): if body: if hasattr(body, 'keys'): error = body[body.keys()[0]] - message = error.get('message', None) - details = error.get('details', None) + message = error.get('message') + details = error.get('details') else: # If we didn't get back a properly formed error message we # probably couldn't communicate with Keystone at all. diff --git a/openstackclient/common/logs.py b/openstackclient/common/logs.py index 7ad6e832..221c5997 100644 --- a/openstackclient/common/logs.py +++ b/openstackclient/common/logs.py @@ -169,7 +169,7 @@ class LogConfigurator(object): self.dump_trace = cloud_config.config.get('debug', self.dump_trace) self.console_logger.setLevel(log_level) - log_file = cloud_config.config.get('log_file', None) + log_file = cloud_config.config.get('log_file') if log_file: if not self.file_logger: self.file_logger = logging.FileHandler(filename=log_file) @@ -179,7 +179,7 @@ class LogConfigurator(object): self.file_logger.setLevel(log_level) self.root_logger.addHandler(self.file_logger) - logconfig = cloud_config.config.get('logging', None) + logconfig = cloud_config.config.get('logging') if logconfig: highest_level = logging.NOTSET for k in logconfig.keys(): |
