summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwingwj <wingwj@gmail.com>2017-03-21 12:55:27 +0800
committerwingwj <wingwj@gmail.com>2017-03-21 14:38:05 +0800
commit1d5774f4983e915f45787e7afd2d290f65cf428c (patch)
tree698ad4790a77991125bebbea3f27d2e3c700afc4
parent5cd7f5c8735544b3faca9763298e3389733a8633 (diff)
downloadpython-keystoneclient-1d5774f4983e915f45787e7afd2d290f65cf428c.tar.gz
Remove log translations in python-keystoneclient
Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: Ia77819cbb133903d20e821bff0c45766b11ef07b
-rw-r--r--keystoneclient/_discover.py19
-rw-r--r--keystoneclient/auth/identity/base.py10
-rw-r--r--keystoneclient/auth/identity/generic/base.py8
-rw-r--r--keystoneclient/common/cms.py10
-rw-r--r--keystoneclient/generic/client.py6
-rw-r--r--keystoneclient/httpclient.py10
-rw-r--r--keystoneclient/i18n.py10
-rw-r--r--keystoneclient/session.py8
8 files changed, 33 insertions, 48 deletions
diff --git a/keystoneclient/_discover.py b/keystoneclient/_discover.py
index a6d5727..69eed9a 100644
--- a/keystoneclient/_discover.py
+++ b/keystoneclient/_discover.py
@@ -27,7 +27,7 @@ import re
from positional import positional
from keystoneclient import exceptions
-from keystoneclient.i18n import _, _LI, _LW
+from keystoneclient.i18n import _
_LOGGER = logging.getLogger(__name__)
@@ -167,8 +167,8 @@ class Discover(object):
try:
status = v['status']
except KeyError:
- _LOGGER.warning(_LW('Skipping over invalid version data. '
- 'No stability status in version.'))
+ _LOGGER.warning('Skipping over invalid version data. '
+ 'No stability status in version.')
continue
status = status.lower()
@@ -210,14 +210,13 @@ class Discover(object):
try:
version_str = v['id']
except KeyError:
- _LOGGER.info(_LI('Skipping invalid version data. Missing ID.'))
+ _LOGGER.info('Skipping invalid version data. Missing ID.')
continue
try:
links = v['links']
except KeyError:
- _LOGGER.info(
- _LI('Skipping invalid version data. Missing links'))
+ _LOGGER.info('Skipping invalid version data. Missing links')
continue
version_number = normalize_version_number(version_str)
@@ -227,15 +226,15 @@ class Discover(object):
rel = link['rel']
url = link['href']
except (KeyError, TypeError):
- _LOGGER.info(_LI('Skipping invalid version link. '
- 'Missing link URL or relationship.'))
+ _LOGGER.info('Skipping invalid version link. '
+ 'Missing link URL or relationship.')
continue
if rel.lower() == 'self':
break
else:
- _LOGGER.info(_LI('Skipping invalid version data. '
- 'Missing link to endpoint.'))
+ _LOGGER.info('Skipping invalid version data. '
+ 'Missing link to endpoint.')
continue
versions.append({'version': version_number,
diff --git a/keystoneclient/auth/identity/base.py b/keystoneclient/auth/identity/base.py
index 29ab121..b20d3e2 100644
--- a/keystoneclient/auth/identity/base.py
+++ b/keystoneclient/auth/identity/base.py
@@ -22,7 +22,6 @@ import six
from keystoneclient import _discover
from keystoneclient.auth import base
from keystoneclient import exceptions
-from keystoneclient.i18n import _LW
LOG = logging.getLogger(__name__)
@@ -317,10 +316,10 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
else:
if not service_type:
- LOG.warning(_LW(
+ LOG.warning(
'Plugin cannot return an endpoint without knowing the '
'service type that is required. Add service_type to '
- 'endpoint filtering data.'))
+ 'endpoint filtering data.')
return None
if not interface:
@@ -353,10 +352,9 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
# NOTE(jamielennox): Again if we can't contact the server we fall
# back to just returning the URL from the catalog. This may not be
# the best default but we need it for now.
- LOG.warning(_LW(
+ LOG.warning(
'Failed to contact the endpoint at %s for discovery. Fallback '
- 'to using that endpoint as the base url.'),
- url)
+ 'to using that endpoint as the base url.', url)
else:
url = disc.url_for(version)
diff --git a/keystoneclient/auth/identity/generic/base.py b/keystoneclient/auth/identity/generic/base.py
index 85207ac..98680ef 100644
--- a/keystoneclient/auth/identity/generic/base.py
+++ b/keystoneclient/auth/identity/generic/base.py
@@ -20,7 +20,7 @@ import six.moves.urllib.parse as urlparse
from keystoneclient import _discover
from keystoneclient.auth.identity import base
from keystoneclient import exceptions
-from keystoneclient.i18n import _, _LW
+from keystoneclient.i18n import _
LOG = logging.getLogger(__name__)
@@ -140,9 +140,9 @@ class BaseGenericPlugin(base.BaseIdentityPlugin):
except (exceptions.DiscoveryFailure,
exceptions.HTTPError,
exceptions.ConnectionError):
- LOG.warning(_LW('Discovering versions from the identity service '
- 'failed when creating the password plugin. '
- 'Attempting to determine version from URL.'))
+ LOG.warning('Discovering versions from the identity service '
+ 'failed when creating the password plugin. '
+ 'Attempting to determine version from URL.')
url_parts = urlparse.urlparse(self.auth_url)
path = url_parts.path.lower()
diff --git a/keystoneclient/common/cms.py b/keystoneclient/common/cms.py
index fb30602..9c3e0bd 100644
--- a/keystoneclient/common/cms.py
+++ b/keystoneclient/common/cms.py
@@ -29,7 +29,7 @@ from debtcollector import removals
import six
from keystoneclient import exceptions
-from keystoneclient.i18n import _, _LE
+from keystoneclient.i18n import _
subprocess = None
@@ -376,11 +376,11 @@ def cms_sign_data(data_to_sign, signing_cert_file_name, signing_key_file_name,
if retcode != OpensslCmsExitStatus.SUCCESS or ('Error' in err):
if retcode == OpensslCmsExitStatus.CREATE_CMS_READ_MIME_ERROR:
- LOG.error(_LE('Signing error: Unable to load certificate - '
- 'ensure you have configured PKI with '
- '"keystone-manage pki_setup"'))
+ LOG.error('Signing error: Unable to load certificate - '
+ 'ensure you have configured PKI with '
+ '"keystone-manage pki_setup"')
else:
- LOG.error(_LE('Signing error: %s'), err)
+ LOG.error('Signing error: %s', err)
raise subprocess.CalledProcessError(retcode, 'openssl')
if outform == PKI_ASN1_FORM:
return output.decode('utf-8')
diff --git a/keystoneclient/generic/client.py b/keystoneclient/generic/client.py
index 6d04802..aee7f67 100644
--- a/keystoneclient/generic/client.py
+++ b/keystoneclient/generic/client.py
@@ -19,7 +19,7 @@ from six.moves.urllib import parse as urlparse
from keystoneclient import exceptions
from keystoneclient import httpclient
-from keystoneclient.i18n import _, _LE
+from keystoneclient.i18n import _
_logger = logging.getLogger(__name__)
@@ -125,7 +125,7 @@ class Client(httpclient.HTTPClient):
else:
raise exceptions.from_response(resp, "GET", url)
except Exception:
- _logger.exception(_LE('Failed to detect available versions.'))
+ _logger.exception('Failed to detect available versions.')
def discover_extensions(self, url=None):
"""Discover Keystone extensions supported.
@@ -169,7 +169,7 @@ class Client(httpclient.HTTPClient):
raise exceptions.from_response(
resp, "GET", "%sextensions" % url)
except Exception:
- _logger.exception(_LE('Failed to check keystone extensions.'))
+ _logger.exception('Failed to check keystone extensions.')
@staticmethod
def _get_version_info(version, root_url):
diff --git a/keystoneclient/httpclient.py b/keystoneclient/httpclient.py
index 4d893c3..e6813f3 100644
--- a/keystoneclient/httpclient.py
+++ b/keystoneclient/httpclient.py
@@ -54,7 +54,7 @@ from keystoneclient import access
from keystoneclient.auth import base
from keystoneclient import baseclient
from keystoneclient import exceptions
-from keystoneclient.i18n import _, _LW
+from keystoneclient.i18n import _
from keystoneclient import session as client_session
@@ -393,7 +393,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
# keyring setup
if use_keyring and keyring is None:
- _logger.warning(_LW('Failed to load keyring modules.'))
+ _logger.warning('Failed to load keyring modules.')
self.use_keyring = use_keyring and keyring is not None
self.force_new_token = force_new_token
self.stale_duration = stale_duration or access.STALE_TOKEN_DURATION
@@ -633,8 +633,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
auth_ref = None
except Exception as e:
auth_ref = None
- _logger.warning(
- _LW('Unable to retrieve token from keyring %s'), e)
+ _logger.warning('Unable to retrieve token from keyring %s', e)
return (keyring_key, auth_ref)
def store_auth_ref_into_keyring(self, keyring_key):
@@ -646,8 +645,7 @@ class HTTPClient(baseclient.Client, base.BaseAuthPlugin):
pickle.dumps(self.auth_ref)) # nosec
# (cjschaef): see bug 1534288
except Exception as e:
- _logger.warning(
- _LW("Failed to store token into keyring %s"), e)
+ _logger.warning("Failed to store token into keyring %s", e)
def _process_management_url(self, region_name):
try:
diff --git a/keystoneclient/i18n.py b/keystoneclient/i18n.py
index fc9a52b..21879ab 100644
--- a/keystoneclient/i18n.py
+++ b/keystoneclient/i18n.py
@@ -25,13 +25,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='keystoneclient')
# The primary translation function using the well-known name "_"
_ = _translators.primary
-
-# Translators for log levels.
-#
-# The abbreviated names are meant to reflect the usual use of a short
-# name like '_'. The "L" is for "log" and the other letter comes from
-# the level.
-_LI = _translators.log_info
-_LW = _translators.log_warning
-_LE = _translators.log_error
-_LC = _translators.log_critical
diff --git a/keystoneclient/session.py b/keystoneclient/session.py
index 41bb124..1c3f30b 100644
--- a/keystoneclient/session.py
+++ b/keystoneclient/session.py
@@ -31,7 +31,7 @@ import six
from six.moves import urllib
from keystoneclient import exceptions
-from keystoneclient.i18n import _, _LI, _LW
+from keystoneclient.i18n import _
osprofiler_web = importutils.try_import("osprofiler.web")
@@ -451,7 +451,7 @@ class Session(object):
if connect_retries <= 0:
raise
- logger.info(_LI('Failure: %(e)s. Retrying in %(delay).1fs.'),
+ logger.info('Failure: %(e)s. Retrying in %(delay).1fs.',
{'e': e, 'delay': connect_retry_delay})
time.sleep(connect_retry_delay)
@@ -478,8 +478,8 @@ class Session(object):
try:
location = resp.headers['location']
except KeyError:
- logger.warning(_LW("Failed to redirect request to %s as new "
- "location was not provided."), resp.url)
+ logger.warning("Failed to redirect request to %s as new "
+ "location was not provided.", resp.url)
else:
# NOTE(jamielennox): We don't pass through connect_retry_delay.
# This request actually worked so we can reset the delay count.