From 5a978b9ec137cece167f0164dbb1754002a81bec Mon Sep 17 00:00:00 2001 From: "ting.wang" <ting.wang@easystack.cn> Date: Sat, 20 Feb 2016 14:09:40 +0800 Subject: [PATCH] Replace string format arguments with function parameters There are files containing string format arguments inside logging messages. Using logging function parameters should be preferred. Change-Id: I15b405bf4d4715263fe1e1262982467b3d4bc1f4 Closes-Bug: #1321274 --- openstackclient/api/auth.py | 4 ++-- openstackclient/api/auth_plugin.py | 2 +- openstackclient/common/clientmanager.py | 4 ++-- openstackclient/compute/client.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openstackclient/api/auth.py b/openstackclient/api/auth.py index 66272e4247..442873188e 100644 --- a/openstackclient/api/auth.py +++ b/openstackclient/api/auth.py @@ -106,7 +106,7 @@ def select_auth_plugin(options): # The ultimate default is similar to the original behaviour, # but this time with version discovery auth_plugin_name = 'osc_password' - LOG.debug("Auth plugin %s selected" % auth_plugin_name) + LOG.debug("Auth plugin %s selected", auth_plugin_name) return auth_plugin_name @@ -130,7 +130,7 @@ def build_auth_params(auth_plugin_name, cmd_options): auth_plugin_class = None plugin_options = set([o.replace('-', '_') for o in get_options_list()]) for option in plugin_options: - LOG.debug('fetching option %s' % option) + LOG.debug('fetching option %s', option) auth_params[option] = getattr(cmd_options.auth, option, None) return (auth_plugin_class, auth_params) diff --git a/openstackclient/api/auth_plugin.py b/openstackclient/api/auth_plugin.py index deddfcc48f..cff0b75dc9 100644 --- a/openstackclient/api/auth_plugin.py +++ b/openstackclient/api/auth_plugin.py @@ -97,7 +97,7 @@ class OSCGenericPassword(ksc_password.Password): ver_u.query, ver_u.fragment, )) - LOG.debug('Version URL updated: %s' % url) + LOG.debug('Version URL updated: %s', url) return super(OSCGenericPassword, self).create_plugin( session=session, diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index dce1972515..5696b9e1bc 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -167,8 +167,8 @@ class ClientManager(object): elif 'tenant_name' in self._auth_params: self._project_name = self._auth_params['tenant_name'] - LOG.info('Using auth plugin: %s' % self.auth_plugin_name) - LOG.debug('Using parameters %s' % + LOG.info('Using auth plugin: %s', self.auth_plugin_name) + LOG.debug('Using parameters %s', strutils.mask_password(self._auth_params)) self.auth = auth_plugin.load_from_options(**self._auth_params) # needed by SAML authentication diff --git a/openstackclient/compute/client.py b/openstackclient/compute/client.py index 23a4decaab..1481ed6535 100644 --- a/openstackclient/compute/client.py +++ b/openstackclient/compute/client.py @@ -42,7 +42,7 @@ def make_client(instance): else: version = instance._api_version[API_NAME] - LOG.debug('Instantiating compute client for V%s' % version) + LOG.debug('Instantiating compute client for V%s', version) # Set client http_log_debug to True if verbosity level is high enough http_log_debug = utils.get_effective_log_level() <= logging.DEBUG