Add missing translation markers
There are couple places where translation markers missed: * /common/http.py * /osc/plugin.py This change adds them. Change-Id: I8fc7edb618023b524157a462ff0b1c3f025e17f3 Closes-Bug: 1517421
This commit is contained in:
parent
b58fe1c2ab
commit
eaa2456b89
@ -29,6 +29,9 @@ import six
|
|||||||
import six.moves.urllib.parse as urlparse
|
import six.moves.urllib.parse as urlparse
|
||||||
|
|
||||||
from ironicclient.common import filecache
|
from ironicclient.common import filecache
|
||||||
|
from ironicclient.common.i18n import _
|
||||||
|
from ironicclient.common.i18n import _LE
|
||||||
|
from ironicclient.common.i18n import _LW
|
||||||
from ironicclient import exc
|
from ironicclient import exc
|
||||||
|
|
||||||
|
|
||||||
@ -90,8 +93,8 @@ class VersionNegotiationMixin(object):
|
|||||||
"""
|
"""
|
||||||
if self.api_version_select_state not in API_VERSION_SELECTED_STATES:
|
if self.api_version_select_state not in API_VERSION_SELECTED_STATES:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
'Error: self.api_version_select_state should be one of the '
|
_('Error: self.api_version_select_state should be one of the '
|
||||||
'values in: "%(valid)s" but had the value: "%(value)s"' %
|
'values in: "%(valid)s" but had the value: "%(value)s"') %
|
||||||
{'valid': ', '.join(API_VERSION_SELECTED_STATES),
|
{'valid': ', '.join(API_VERSION_SELECTED_STATES),
|
||||||
'value': self.api_version_select_state})
|
'value': self.api_version_select_state})
|
||||||
min_ver, max_ver = self._parse_version_headers(resp)
|
min_ver, max_ver = self._parse_version_headers(resp)
|
||||||
@ -113,17 +116,17 @@ class VersionNegotiationMixin(object):
|
|||||||
# be supported by the requested version.
|
# be supported by the requested version.
|
||||||
if self.api_version_select_state == 'user':
|
if self.api_version_select_state == 'user':
|
||||||
raise exc.UnsupportedVersion(textwrap.fill(
|
raise exc.UnsupportedVersion(textwrap.fill(
|
||||||
"Requested API version %(req)s is not supported by the "
|
_("Requested API version %(req)s is not supported by the "
|
||||||
"server or the requested operation is not supported by the "
|
"server or the requested operation is not supported by the "
|
||||||
"requested version. Supported version range is %(min)s to "
|
"requested version. Supported version range is %(min)s to "
|
||||||
"%(max)s"
|
"%(max)s")
|
||||||
% {'req': self.os_ironic_api_version,
|
% {'req': self.os_ironic_api_version,
|
||||||
'min': min_ver, 'max': max_ver}))
|
'min': min_ver, 'max': max_ver}))
|
||||||
if self.api_version_select_state == 'negotiated':
|
if self.api_version_select_state == 'negotiated':
|
||||||
raise exc.UnsupportedVersion(textwrap.fill(
|
raise exc.UnsupportedVersion(textwrap.fill(
|
||||||
"No API version was specified and the requested operation was "
|
_("No API version was specified and the requested operation "
|
||||||
"not supported by the client's negotiated API version "
|
"was not supported by the client's negotiated API version "
|
||||||
"%(req)s. Supported version range is: %(min)s to %(max)s"
|
"%(req)s. Supported version range is: %(min)s to %(max)s")
|
||||||
% {'req': self.os_ironic_api_version,
|
% {'req': self.os_ironic_api_version,
|
||||||
'min': min_ver, 'max': max_ver}))
|
'min': min_ver, 'max': max_ver}))
|
||||||
|
|
||||||
@ -177,8 +180,8 @@ def with_retries(func):
|
|||||||
try:
|
try:
|
||||||
return func(self, url, method, **kwargs)
|
return func(self, url, method, **kwargs)
|
||||||
except _RETRY_EXCEPTIONS as error:
|
except _RETRY_EXCEPTIONS as error:
|
||||||
msg = ("Error contacting Ironic server: %(error)s. "
|
msg = (_LE("Error contacting Ironic server: %(error)s. "
|
||||||
"Attempt %(attempt)d of %(total)d" %
|
"Attempt %(attempt)d of %(total)d") %
|
||||||
{'attempt': attempt,
|
{'attempt': attempt,
|
||||||
'total': num_attempts,
|
'total': num_attempts,
|
||||||
'error': error})
|
'error': error})
|
||||||
@ -228,7 +231,7 @@ class HTTPClient(VersionNegotiationMixin):
|
|||||||
elif parts.scheme == 'http':
|
elif parts.scheme == 'http':
|
||||||
_class = six.moves.http_client.HTTPConnection
|
_class = six.moves.http_client.HTTPConnection
|
||||||
else:
|
else:
|
||||||
msg = 'Unsupported scheme: %s' % parts.scheme
|
msg = _('Unsupported scheme: %s') % parts.scheme
|
||||||
raise exc.EndpointException(msg)
|
raise exc.EndpointException(msg)
|
||||||
|
|
||||||
return (_class, _args, _kwargs)
|
return (_class, _args, _kwargs)
|
||||||
@ -324,12 +327,12 @@ class HTTPClient(VersionNegotiationMixin):
|
|||||||
return self._http_request(url, method, **kwargs)
|
return self._http_request(url, method, **kwargs)
|
||||||
|
|
||||||
except socket.gaierror as e:
|
except socket.gaierror as e:
|
||||||
message = ("Error finding address for %(url)s: %(e)s"
|
message = (_("Error finding address for %(url)s: %(e)s")
|
||||||
% dict(url=url, e=e))
|
% dict(url=url, e=e))
|
||||||
raise exc.EndpointNotFound(message)
|
raise exc.EndpointNotFound(message)
|
||||||
except (socket.error, socket.timeout) as e:
|
except (socket.error, socket.timeout) as e:
|
||||||
endpoint = self.endpoint
|
endpoint = self.endpoint
|
||||||
message = ("Error communicating with %(endpoint)s %(e)s"
|
message = (_("Error communicating with %(endpoint)s %(e)s")
|
||||||
% dict(endpoint=endpoint, e=e))
|
% dict(endpoint=endpoint, e=e))
|
||||||
raise exc.ConnectionRefused(message)
|
raise exc.ConnectionRefused(message)
|
||||||
|
|
||||||
@ -345,7 +348,7 @@ class HTTPClient(VersionNegotiationMixin):
|
|||||||
self.log_http_response(resp)
|
self.log_http_response(resp)
|
||||||
|
|
||||||
if 400 <= resp.status < 600:
|
if 400 <= resp.status < 600:
|
||||||
LOG.warning("Request returned failure status.")
|
LOG.warning(_LW("Request returned failure status"))
|
||||||
error_json = _extract_error_json(body_str)
|
error_json = _extract_error_json(body_str)
|
||||||
raise exc.from_response(
|
raise exc.from_response(
|
||||||
resp, error_json.get('faultstring'),
|
resp, error_json.get('faultstring'),
|
||||||
@ -377,7 +380,7 @@ class HTTPClient(VersionNegotiationMixin):
|
|||||||
try:
|
try:
|
||||||
body = json.loads(body)
|
body = json.loads(body)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
LOG.error('Could not decode response body as JSON')
|
LOG.error(_LE('Could not decode response body as JSON'))
|
||||||
else:
|
else:
|
||||||
body = None
|
body = None
|
||||||
|
|
||||||
@ -529,7 +532,7 @@ class SessionClient(VersionNegotiationMixin, adapter.LegacyJsonAdapter):
|
|||||||
try:
|
try:
|
||||||
body = resp.json()
|
body = resp.json()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
LOG.error('Could not decode response body as JSON')
|
LOG.error(_LE('Could not decode response body as JSON'))
|
||||||
else:
|
else:
|
||||||
body = None
|
body = None
|
||||||
|
|
||||||
@ -591,8 +594,9 @@ def _construct_http_client(endpoint=None,
|
|||||||
dvars = [k for k, v in ignored.items() if v]
|
dvars = [k for k, v in ignored.items() if v]
|
||||||
|
|
||||||
if dvars:
|
if dvars:
|
||||||
LOG.warning('The following arguments are ignored when using the '
|
LOG.warning(_LW('The following arguments are ignored when using '
|
||||||
'session to construct a client: %s', ', '.join(dvars))
|
'the session to construct a client: %s'),
|
||||||
|
', '.join(dvars))
|
||||||
|
|
||||||
return SessionClient(session=session,
|
return SessionClient(session=session,
|
||||||
os_ironic_api_version=os_ironic_api_version,
|
os_ironic_api_version=os_ironic_api_version,
|
||||||
@ -603,8 +607,8 @@ def _construct_http_client(endpoint=None,
|
|||||||
**kwargs)
|
**kwargs)
|
||||||
else:
|
else:
|
||||||
if kwargs:
|
if kwargs:
|
||||||
LOG.warning('The following arguments are being ignored when '
|
LOG.warning(_LW('The following arguments are being ignored when '
|
||||||
'constructing the client: %s', ', '.join(kwargs))
|
'constructing the client: %s'), ', '.join(kwargs))
|
||||||
|
|
||||||
return HTTPClient(endpoint=endpoint,
|
return HTTPClient(endpoint=endpoint,
|
||||||
token=token,
|
token=token,
|
||||||
|
@ -19,6 +19,7 @@ import logging
|
|||||||
from openstackclient.common import exceptions
|
from openstackclient.common import exceptions
|
||||||
from openstackclient.common import utils
|
from openstackclient.common import utils
|
||||||
|
|
||||||
|
from ironicclient.common.i18n import _
|
||||||
from ironicclient.osc import client as ironic_client
|
from ironicclient.osc import client as ironic_client
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -40,9 +41,11 @@ def make_client(instance):
|
|||||||
baremetal_client = ironic_client.get_client_class(
|
baremetal_client = ironic_client.get_client_class(
|
||||||
instance._api_version[API_NAME])
|
instance._api_version[API_NAME])
|
||||||
except Exception:
|
except Exception:
|
||||||
msg = "Invalid %s client version '%s'. Must be one of %s" % (
|
msg = (_("Invalid %(api_name)s client version '%(ver)s'. Must be one "
|
||||||
(API_NAME, instance._api_version[API_NAME],
|
"of %(supported_ver)s") %
|
||||||
", ".join(sorted(API_VERSIONS))))
|
{'api_name': API_NAME,
|
||||||
|
'ver': instance._api_version[API_NAME],
|
||||||
|
'supported_ver': ", ".join(sorted(API_VERSIONS))})
|
||||||
raise exceptions.UnsupportedVersion(msg)
|
raise exceptions.UnsupportedVersion(msg)
|
||||||
LOG.debug('Instantiating baremetal client: %s', baremetal_client)
|
LOG.debug('Instantiating baremetal client: %s', baremetal_client)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user