Merge "Log translation hint for Heat.contrib"

This commit is contained in:
Jenkins
2014-10-15 08:40:56 +00:00
committed by Gerrit Code Review
7 changed files with 31 additions and 24 deletions

View File

@@ -17,6 +17,7 @@
import six
from heat.common.i18n import _
from heat.common.i18n import _LW
from heat.engine import attributes
from heat.engine import properties
from heat.engine import resource
@@ -346,5 +347,5 @@ def available_resource_mapping():
if DOCKER_INSTALLED:
return resource_mapping()
else:
LOG.warn(_("Docker plug-in loaded, but docker lib not installed."))
LOG.warn(_LW("Docker plug-in loaded, but docker lib not installed."))
return {}

View File

@@ -20,11 +20,13 @@ from oslo.config import cfg
from oslo.utils import importutils
from heat.common import exception
from heat.common.i18n import _
from heat.common.i18n import _LE
from heat.common.i18n import _LI
from heat.common.i18n import _LW
from heat.openstack.common import log as logging
LOG = logging.getLogger('heat.common.keystoneclient')
LOG.info(_("Keystone V2 loaded"))
LOG.info(_LI("Keystone V2 loaded"))
class KeystoneClientV2(object):
@@ -87,8 +89,8 @@ class KeystoneClientV2(object):
kwargs['tenant_name'] = self.context.tenant
kwargs['tenant_id'] = self.context.tenant_id
else:
LOG.error(_("Keystone v2 API connection failed, no password "
"or auth_token!"))
LOG.error(_LE("Keystone v2 API connection failed, no password "
"or auth_token!"))
raise exception.AuthorizationFailure()
kwargs['cacert'] = self._get_client_option('ca_file')
kwargs['insecure'] = self._get_client_option('insecure')
@@ -102,7 +104,7 @@ class KeystoneClientV2(object):
if auth_kwargs:
# Sanity check
if not client.auth_ref.trust_scoped:
LOG.error(_("v2 trust token re-scoping failed!"))
LOG.error(_LE("v2 trust token re-scoping failed!"))
raise exception.AuthorizationFailure()
# All OK so update the context with the token
self.context.auth_token = client.auth_ref.auth_token
@@ -110,8 +112,8 @@ class KeystoneClientV2(object):
# Ensure the v2 API we're using is not impacted by keystone
# bug #1239303, otherwise we can't trust the user_id
if self.context.trustor_user_id != client.auth_ref.user_id:
LOG.error(_("Trust impersonation failed, bug #1239303 "
"suspected, you may need a newer keystone"))
LOG.error(_LE("Trust impersonation failed, bug #1239303 "
"suspected, you may need a newer keystone"))
raise exception.AuthorizationFailure()
return client
@@ -147,8 +149,8 @@ class KeystoneClientV2(object):
Returns the keystone ID of the resulting user
"""
if(len(username) > 64):
LOG.warning(_("Truncating the username %s to the last 64 "
"characters.") % username)
LOG.warn(_LW("Truncating the username %s to the last 64 "
"characters."), username)
#get the last 64 characters of the username
username = username[-64:]
user = self.client.users.create(username,
@@ -171,10 +173,10 @@ class KeystoneClientV2(object):
self.client.roles.add_user_role(user.id, role_id,
self.context.tenant_id)
else:
LOG.error(_("Failed to add user %(user)s to role %(role)s, "
"check role exists!")
% {'user': username,
'role': cfg.CONF.heat_stack_user_role})
LOG.error(_LE("Failed to add user %(user)s to role %(role)s, "
"check role exists!"),
{'user': username,
'role': cfg.CONF.heat_stack_user_role})
return user.id

View File

@@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from heat.common.i18n import _
from heat.common.i18n import _LE
from heat.openstack.common import log as logging
LOG = logging.getLogger(__name__)
@@ -30,7 +30,7 @@ class ZaqarClientPlugin(client_plugin.ClientPlugin):
con = self.context
if self.auth_token is None:
LOG.error(_("Zaqar connection failed, no auth_token!"))
LOG.error(_LE("Zaqar connection failed, no auth_token!"))
return None
opts = {

View File

@@ -21,7 +21,8 @@ import urlparse
from oslo.config import cfg
from heat.common import exception
from heat.common.i18n import _
from heat.common.i18n import _LI
from heat.common.i18n import _LW
from heat.engine.clients import client_plugin
from heat.engine.clients.os import cinder
from heat.engine.clients.os import glance
@@ -57,7 +58,7 @@ class RackspaceClientPlugin(client_plugin.ClientPlugin):
"""Create an authenticated client context."""
self.pyrax = pyrax.create_context("rackspace")
self.pyrax.auth_endpoint = self.context.auth_url
LOG.info(_("Authenticating username: %s") %
LOG.info(_LI("Authenticating username: %s") %
self.context.username)
tenant = self.context.tenant_id
tenant_name = self.context.tenant
@@ -65,9 +66,9 @@ class RackspaceClientPlugin(client_plugin.ClientPlugin):
tenant_id=tenant,
tenant_name=tenant_name)
if not self.pyrax.authenticated:
LOG.warn(_("Pyrax Authentication Failed."))
LOG.warn(_LW("Pyrax Authentication Failed."))
raise exception.AuthorizationFailure()
LOG.info(_("User %s authenticated successfully."),
LOG.info(_LI("User %s authenticated successfully."),
self.context.username)

View File

@@ -18,6 +18,7 @@ import six
from heat.common import exception
from heat.common.i18n import _
from heat.common.i18n import _LI
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import function
@@ -672,7 +673,7 @@ class CloudLoadBalancer(resource.Resource):
raise exception.InvalidTemplateAttribute(resource=self.name,
key=key)
function = attribute_function[key]
LOG.info(_('%(name)s.GetAtt(%(key)s) == %(function)s'),
LOG.info(_LI('%(name)s.GetAtt(%(key)s) == %(function)s'),
{'name': self.name, 'key': key, 'function': function})
return function

View File

@@ -15,6 +15,7 @@ import copy
from heat.common import exception
from heat.common.i18n import _
from heat.common.i18n import _LW
from heat.engine import attributes
from heat.engine import properties
from heat.engine.resources import server
@@ -181,7 +182,7 @@ class CloudServer(server.Server):
reason = server.metadata.get('rackconnect_unprocessable_reason',
None)
if reason is not None:
LOG.warning(_("RackConnect unprocessable reason: %s") % reason)
LOG.warn(_LW("RackConnect unprocessable reason: %s"), reason)
msg = _("RackConnect automation has completed")
self._add_event(self.action, self.status, msg)

View File

@@ -15,6 +15,7 @@ import netaddr
from heat.common import exception
from heat.common.i18n import _
from heat.common.i18n import _LW
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import properties
@@ -93,8 +94,8 @@ class CloudNetwork(resource.Resource):
try:
self._network = self.cloud_networks().get(self.resource_id)
except NotFound:
LOG.warn(_("Could not find network %s but resource id is set.")
% self.resource_id)
LOG.warn(_LW("Could not find network %s but resource id is"
" set."), self.resource_id)
return self._network
def cloud_networks(self):