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) id_list)
else: else:
raise exception.Error( raise exception.Error(
"Unsupported resource '%s' in LoadBalancerNames" % _("Unsupported resource '%s' in LoadBalancerNames") %
(lb,)) (lb,))
resolved_snippet = self.stack.resolve_static_data( resolved_snippet = self.stack.resolve_static_data(
lb_resource.json_snippet) lb_resource.json_snippet)

View File

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

View File

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

View File

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

View File

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