Merge "I18N support for error message"

This commit is contained in:
Jenkins 2014-03-05 10:46:09 +00:00 committed by Gerrit Code Review
commit 80c414143d
5 changed files with 15 additions and 11 deletions

View File

@ -398,7 +398,7 @@ class InstanceGroup(stack_resource.StackResource):
id_list)
else:
raise exception.Error(
"Unsupported resource '%s' in LoadBalancerNames" %
_("Unsupported resource '%s' in LoadBalancerNames") %
(lb,))
resolved_snippet = self.stack.resolve_static_data(
lb_resource.json_snippet)

View File

@ -352,11 +352,15 @@ class Pool(neutron.NeutronResource):
elif vip_attributes['status'] == 'ACTIVE':
return True
raise exception.Error(
'neutron reported unexpected vip resource[%s] status[%s]' %
(vip_attributes['name'], vip_attributes['status']))
_('neutron reported unexpected vip resource[%(name)s] '
'status[%(status)s]') %
{'name': vip_attributes['name'],
'status': vip_attributes['status']})
raise exception.Error(
'neutron report unexpected pool resource[%s] status[%s]' %
(attributes['name'], attributes['status']))
_('neutron reported unexpected pool resource[%(name)s] '
'status[%(status)s]') %
{'name': attributes['name'],
'status': attributes['status']})
def handle_update(self, json_snippet, tmpl_diff, prop_diff):
if prop_diff:

View File

@ -114,9 +114,10 @@ class NeutronResource(resource.Resource):
if attributes['status'] in ('ACTIVE', 'DOWN'):
return True
else:
raise exception.Error('%s resource[%s] status[%s]' %
('neutron reported unexpected',
attributes['name'], attributes['status']))
raise exception.Error(_('neutron reported unexpected '
'resource[%(name)s] status[%(status)s]') %
{'name': attributes['name'],
'status': attributes['status']})
def _resolve_attribute(self, name):
try:

View File

@ -107,8 +107,7 @@ class Volume(resource.Resource):
cinder = self.cinder()
if backup_id is not None:
if volume_backups is None:
raise exception.Error(
'%s not supported' % self.BACKUP_ID)
raise exception.Error(_('Backups not supported.'))
vol_id = cinder.restores.restore(backup_id).volume_id
vol = cinder.volumes.get(vol_id)

View File

@ -370,7 +370,7 @@ class PoolTest(HeatTestCase):
error = self.assertRaises(exception.ResourceFailure,
scheduler.TaskRunner(rsrc.create))
self.assertEqual(
'Error: neutron report unexpected pool '
'Error: neutron reported unexpected pool '
'resource[5678] status[ERROR]',
str(error))
self.assertEqual((rsrc.CREATE, rsrc.FAILED), rsrc.state)