Merge "Remove log translations in python-keystoneclient"
This commit is contained in:
commit
1e7543786e
@ -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,
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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')
|
||||
|
@ -20,7 +20,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__)
|
||||
@ -131,7 +131,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.
|
||||
@ -175,7 +175,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):
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
||||
@ -476,7 +476,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)
|
||||
|
||||
@ -503,8 +503,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.
|
||||
|
Loading…
Reference in New Issue
Block a user