Add i18n translation to others 2/3
This is 2 of 3 commits that adds i18n translation to misc files. Custom hacking rules will be added to enforce this style. Change-Id: I44ac13e9431018e18980e8ff7ff442c7fea68a13
This commit is contained in:
parent
4f9c538f68
commit
97f2916f87
@ -18,6 +18,7 @@ from neutronclient.common import exceptions as neutron_exceptions
|
||||
from oslo_log import log as logging
|
||||
|
||||
from trove.common import exception
|
||||
from trove.common.i18n import _
|
||||
from trove.common import remote
|
||||
from trove.network import base
|
||||
|
||||
@ -51,7 +52,7 @@ class NeutronDriver(base.NetworkDriver):
|
||||
try:
|
||||
return self.client.show_security_group(security_group=group_id)
|
||||
except neutron_exceptions.NeutronClientException as e:
|
||||
LOG.exception('Failed to get remote security group')
|
||||
LOG.exception(_('Failed to get remote security group'))
|
||||
raise exception.TroveError(str(e))
|
||||
|
||||
def create_security_group(self, name, description):
|
||||
@ -63,14 +64,14 @@ class NeutronDriver(base.NetworkDriver):
|
||||
sec_group.get('security_group', sec_group))
|
||||
|
||||
except neutron_exceptions.NeutronClientException as e:
|
||||
LOG.exception('Failed to create remote security group')
|
||||
LOG.exception(_('Failed to create remote security group'))
|
||||
raise exception.SecurityGroupCreationError(str(e))
|
||||
|
||||
def delete_security_group(self, sec_group_id):
|
||||
try:
|
||||
self.client.delete_security_group(security_group=sec_group_id)
|
||||
except neutron_exceptions.NeutronClientException as e:
|
||||
LOG.exception('Failed to delete remote security group')
|
||||
LOG.exception(_('Failed to delete remote security group'))
|
||||
raise exception.SecurityGroupDeletionError(str(e))
|
||||
|
||||
def add_security_group_rule(self, sec_group_id, protocol,
|
||||
@ -95,9 +96,10 @@ class NeutronDriver(base.NetworkDriver):
|
||||
except neutron_exceptions.NeutronClientException as e:
|
||||
# ignore error if rule already exists
|
||||
if e.status_code == 409:
|
||||
LOG.exception("secgroup rule already exists")
|
||||
LOG.exception(_("Security group rule already exists"))
|
||||
else:
|
||||
LOG.exception('Failed to add rule to remote security group')
|
||||
LOG.exception(_('Failed to add rule to remote security '
|
||||
'group'))
|
||||
raise exception.SecurityGroupRuleCreationError(str(e))
|
||||
|
||||
def delete_security_group_rule(self, sec_group_rule_id):
|
||||
@ -106,7 +108,7 @@ class NeutronDriver(base.NetworkDriver):
|
||||
security_group_rule=sec_group_rule_id)
|
||||
|
||||
except neutron_exceptions.NeutronClientException as e:
|
||||
LOG.exception('Failed to delete rule to remote security group')
|
||||
LOG.exception(_('Failed to delete rule to remote security group'))
|
||||
raise exception.SecurityGroupRuleDeletionError(str(e))
|
||||
|
||||
def _convert_to_nova_security_group_format(self, security_group):
|
||||
|
@ -18,6 +18,7 @@ from novaclient import exceptions as nova_exceptions
|
||||
from oslo_log import log as logging
|
||||
|
||||
from trove.common import exception
|
||||
from trove.common.i18n import _
|
||||
from trove.common import remote
|
||||
from trove.network import base
|
||||
|
||||
@ -38,7 +39,7 @@ class NovaNetwork(base.NetworkDriver):
|
||||
try:
|
||||
return self.client.security_groups.get(group_id)
|
||||
except nova_exceptions.ClientException as e:
|
||||
LOG.exception('Failed to get remote security group')
|
||||
LOG.exception(_('Failed to get remote security group'))
|
||||
raise exception.TroveError(str(e))
|
||||
|
||||
def create_security_group(self, name, description):
|
||||
@ -47,14 +48,14 @@ class NovaNetwork(base.NetworkDriver):
|
||||
name=name, description=description)
|
||||
return sec_group
|
||||
except nova_exceptions.ClientException as e:
|
||||
LOG.exception('Failed to create remote security group')
|
||||
LOG.exception(_('Failed to create remote security group'))
|
||||
raise exception.SecurityGroupCreationError(str(e))
|
||||
|
||||
def delete_security_group(self, sec_group_id):
|
||||
try:
|
||||
self.client.security_groups.delete(sec_group_id)
|
||||
except nova_exceptions.ClientException as e:
|
||||
LOG.exception('Failed to delete remote security group')
|
||||
LOG.exception(_('Failed to delete remote security group'))
|
||||
raise exception.SecurityGroupDeletionError(str(e))
|
||||
|
||||
def add_security_group_rule(self, sec_group_id, protocol,
|
||||
@ -69,7 +70,7 @@ class NovaNetwork(base.NetworkDriver):
|
||||
|
||||
return sec_group_rule
|
||||
except nova_exceptions.ClientException as e:
|
||||
LOG.exception('Failed to add rule to remote security group')
|
||||
LOG.exception(_('Failed to add rule to remote security group'))
|
||||
raise exception.SecurityGroupRuleCreationError(str(e))
|
||||
|
||||
def delete_security_group_rule(self, sec_group_rule_id):
|
||||
@ -77,5 +78,5 @@ class NovaNetwork(base.NetworkDriver):
|
||||
self.client.security_group_rules.delete(sec_group_rule_id)
|
||||
|
||||
except nova_exceptions.ClientException as e:
|
||||
LOG.exception('Failed to delete rule to remote security group')
|
||||
LOG.exception(_('Failed to delete rule to remote security group'))
|
||||
raise exception.SecurityGroupRuleDeletionError(str(e))
|
||||
|
Loading…
Reference in New Issue
Block a user