diff options
author | Trevor McCasland <TM2086@att.com> | 2016-12-05 11:23:26 -0600 |
---|---|---|
committer | Trevor McCasland <TM2086@att.com> | 2016-12-20 09:25:41 -0600 |
commit | 97f2916f87134d6d9acfb22d2a662bacb1d935cf (patch) | |
tree | a43f7756df2ab001b52d7f706557ce46399214f7 /trove/network | |
parent | 4f9c538f682c0f7234110ec5d1abe933e4ab5bde (diff) | |
download | trove-97f2916f87134d6d9acfb22d2a662bacb1d935cf.tar.gz |
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
Diffstat (limited to 'trove/network')
-rw-r--r-- | trove/network/neutron.py | 14 | ||||
-rw-r--r-- | trove/network/nova.py | 11 |
2 files changed, 14 insertions, 11 deletions
diff --git a/trove/network/neutron.py b/trove/network/neutron.py index c8c60d9c..3a5f59dc 100644 --- a/trove/network/neutron.py +++ b/trove/network/neutron.py @@ -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): diff --git a/trove/network/nova.py b/trove/network/nova.py index a66a8be4..c45e9481 100644 --- a/trove/network/nova.py +++ b/trove/network/nova.py @@ -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)) |