Fix xenial pep8 problems - add translations

Change-Id: Ib37f13cecd1078adb00227d604bfe02ccc1527ab
This commit is contained in:
Adit Sarfaty 2016-08-01 08:42:01 +03:00
parent d528f56b3e
commit 7a9336f09f
4 changed files with 10 additions and 8 deletions

View File

@ -16,7 +16,7 @@ import logging
import six
import sys
from vmware_nsx._i18n import _LI
from vmware_nsx._i18n import _LI, _
LOG = logging.getLogger(__name__)
@ -47,8 +47,8 @@ def parse_multi_keyval_opt(opt_list):
key, value = opt_value.split('=')
result[key] = value
except ValueError:
raise ValueError("Illegal argument [%s]: input should have the "
"format of '--property key=value'" % opt_value)
raise ValueError(_("Illegal argument [%s]: input should have the "
"format of '--property key=value'") % opt_value)
return result
@ -71,7 +71,7 @@ def query_yes_no(question, default="yes"):
elif default == "no":
prompt = " [y/N] "
else:
raise ValueError("invalid default answer: '%s'" % default)
raise ValueError(_("invalid default answer: '%s'") % default)
while True:
sys.stdout.write(question + prompt)

View File

@ -182,7 +182,7 @@ def recreate_vdr_dhcp_edge(context, plugin, edge_manager,
{'vdr_id': vdr_router_id,
'edge_id': new_binding['dhcp_edge_id']})
else:
LOG.error(_LI("VDR router %(vdr_id)s was not moved to a new edge"),
LOG.error(_LE("VDR router %(vdr_id)s was not moved to a new edge"),
{'vdr_id': vdr_router_id})
@ -228,7 +228,7 @@ def recreate_network_dhcp(context, plugin, edge_manager, old_edge_id, net_id):
LOG.info(_LI("Network %(net_id)s was moved to edge %(edge_id)s"),
{'net_id': net_id, 'edge_id': new_binding['edge_id']})
else:
LOG.error(_LI("Network %(net_id)s was not moved to a new edge"),
LOG.error(_LE("Network %(net_id)s was not moved to a new edge"),
{'net_id': net_id})

View File

@ -20,6 +20,7 @@ from tempest.api.network import base
from tempest import config
from tempest import test
from vmware_nsx_tempest._i18n import _
from vmware_nsx_tempest._i18n import _LI
from vmware_nsx_tempest._i18n import _LW
from vmware_nsx_tempest.common import constants
@ -244,7 +245,7 @@ class BaseL2GatewayTest(base.BaseAdminNetworkTest):
"""
response = self.nsxv3_client_obj.get_bridge_cluster_info()
if len(response) == 0:
raise RuntimeError("NSX bridge cluster information is null")
raise RuntimeError(_("NSX bridge cluster information is null"))
return [(x.get("id"), x.get("display_name")) for x in response]
def create_l2gw_connection(self, l2gwc_param):

View File

@ -16,6 +16,7 @@ from tempest.lib.common.utils import misc as misc_utils
from tempest.lib import exceptions as lib_exc
from tempest import exceptions
from vmware_nsx_tempest._i18n import _
from vmware_nsx_tempest.services import network_client_base as base
POOL_RID = 'pools'
@ -234,7 +235,7 @@ class LoadBalancerV1Client(base.BaseNetworkClient):
try:
getattr(client, method)(id)
except AttributeError:
raise Exception("Unknown resource type %s " % resource_type)
raise Exception(_("Unknown resource type %s ") % resource_type)
except lib_exc.NotFound:
return True
return False