From 7a9336f09fd85533c9bb79057be0ef5fa3d3cdf4 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Mon, 1 Aug 2016 08:42:01 +0300 Subject: [PATCH] Fix xenial pep8 problems - add translations Change-Id: Ib37f13cecd1078adb00227d604bfe02ccc1527ab --- vmware_nsx/shell/admin/plugins/common/utils.py | 8 ++++---- .../shell/admin/plugins/nsxv/resources/dhcp_binding.py | 4 ++-- vmware_nsx_tempest/services/base_l2gw.py | 3 ++- vmware_nsx_tempest/services/load_balancer_v1_client.py | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/vmware_nsx/shell/admin/plugins/common/utils.py b/vmware_nsx/shell/admin/plugins/common/utils.py index 02fbde68f9..bd3e18802a 100644 --- a/vmware_nsx/shell/admin/plugins/common/utils.py +++ b/vmware_nsx/shell/admin/plugins/common/utils.py @@ -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) diff --git a/vmware_nsx/shell/admin/plugins/nsxv/resources/dhcp_binding.py b/vmware_nsx/shell/admin/plugins/nsxv/resources/dhcp_binding.py index ea9efbbaa0..7258db8468 100644 --- a/vmware_nsx/shell/admin/plugins/nsxv/resources/dhcp_binding.py +++ b/vmware_nsx/shell/admin/plugins/nsxv/resources/dhcp_binding.py @@ -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}) diff --git a/vmware_nsx_tempest/services/base_l2gw.py b/vmware_nsx_tempest/services/base_l2gw.py index 78b73147a1..43e2a89116 100644 --- a/vmware_nsx_tempest/services/base_l2gw.py +++ b/vmware_nsx_tempest/services/base_l2gw.py @@ -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): diff --git a/vmware_nsx_tempest/services/load_balancer_v1_client.py b/vmware_nsx_tempest/services/load_balancer_v1_client.py index 87a32aa749..734d9691f3 100644 --- a/vmware_nsx_tempest/services/load_balancer_v1_client.py +++ b/vmware_nsx_tempest/services/load_balancer_v1_client.py @@ -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