Support i18n for LOG.warning

log warning msg with _LW(), to support i18n translation.

Change-Id: I17b1eeec286d34ce2ebddfb9c4251707af2e2e53
This commit is contained in:
LiuNanke 2016-12-06 18:47:10 +08:00
parent 3282efca9a
commit 3a7135516c
2 changed files with 6 additions and 4 deletions

View File

@ -27,6 +27,7 @@ import six
from six.moves import urllib
from muranoclient.common import exceptions as exc
from muranoclient.i18n import _LW
LOG = logging.getLogger(__name__)
USER_AGENT = 'python-muranoclient'
@ -48,7 +49,7 @@ def get_system_ca_file():
if os.path.exists(ca):
LOG.debug("Using ca file %s", ca)
return ca
LOG.warning("System ca file could not be found.")
LOG.warning(_LW("System ca file could not be found."))
class HTTPClient(object):
@ -370,5 +371,5 @@ def _set_data(kwargs):
if 'data' in kwargs:
raise ValueError("Can't provide both 'data' and "
"'body' to a request")
LOG.warning("Use of 'body' is deprecated; use 'data' instead")
LOG.warning(_LW("Use of 'body' is deprecated; use 'data' instead"))
kwargs['data'] = kwargs.pop('body')

View File

@ -43,6 +43,7 @@ import yaql
from muranoclient.common import exceptions
from muranoclient.i18n import _
from muranoclient.i18n import _LW
try:
import yaql.language # noqa
@ -592,8 +593,8 @@ def ensure_images(glance_client, image_specs, base_url,
def _image_valid(image, keys):
for key in keys:
if key not in image:
LOG.warning("Image specification invalid: "
"No {0} key in image ".format(key))
LOG.warning(_LW("Image specification invalid: "
"No {0} key in image ").format(key))
return False
return True