Remove log translations
Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers from this repository (including _ in test codes) to simplify logging and to avoid confusion with new contributions.[1][2][3] This commit also removes N537 for flake8 ignore list. [1]http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html [2]http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html [3]https://docs.openstack.org/developer/oslo.i18n/guidelines.html#choosing-a-marker-function Change-Id: Ie0a8a2d9b3eec27608e5efcecd09455ef3024c38
This commit is contained in:
parent
f12d6d9086
commit
6a53316cbe
|
@ -27,16 +27,6 @@ _C = _translators.contextual_form
|
|||
# The plural translation function using the name "_P"
|
||||
_P = _translators.plural_form
|
||||
|
||||
# Translators for log levels.
|
||||
#
|
||||
# The abbreviated names are meant to reflect the usual use of a short
|
||||
# name like '_'. The "L" is for "log" and the other letter comes from
|
||||
# the level.
|
||||
_LI = _translators.log_info
|
||||
_LW = _translators.log_warning
|
||||
_LE = _translators.log_error
|
||||
_LC = _translators.log_critical
|
||||
|
||||
|
||||
def get_available_languages():
|
||||
return oslo_i18n.get_available_languages(DOMAIN)
|
||||
|
|
|
@ -42,7 +42,6 @@ from oslo_log import log as logging
|
|||
|
||||
from neutron_lib import constants
|
||||
|
||||
from neutron_fwaas._i18n import _, _LW
|
||||
from neutron_fwaas import privileged
|
||||
from neutron_fwaas.privileged import netlink_constants as nl_constants
|
||||
from neutron_fwaas.privileged import utils as fwaas_utils
|
||||
|
@ -148,7 +147,7 @@ class ConntrackManager(object):
|
|||
self._set_attributes(conntrack, entry)
|
||||
self._query(nl_constants.NFCT_Q_DESTROY, conntrack)
|
||||
except Exception as e:
|
||||
msg = _("Failed to delete conntrack entries %s") % e
|
||||
msg = "Failed to delete conntrack entries %s" % e
|
||||
LOG.critical(msg)
|
||||
raise ConntrackOpenFailedExit(msg)
|
||||
finally:
|
||||
|
@ -163,7 +162,7 @@ class ConntrackManager(object):
|
|||
result = nfct.nfct_query(self.conntrack_handler, query_type,
|
||||
query_data)
|
||||
if result == nl_constants.NFCT_CB_FAILURE:
|
||||
LOG.warning(_LW("Netlink query failed"))
|
||||
LOG.warning("Netlink query failed")
|
||||
|
||||
def _set_attributes(self, conntrack, entry):
|
||||
ipversion = entry.get('ipversion', 4)
|
||||
|
@ -185,7 +184,7 @@ class ConntrackManager(object):
|
|||
nl_constants.CONNTRACK,
|
||||
nl_constants.NFNL_SUBSYS_CTNETLINK)
|
||||
if not self.conntrack_handler:
|
||||
msg = _("Failed to open new conntrack handler")
|
||||
msg = "Failed to open new conntrack handler"
|
||||
LOG.critical(msg)
|
||||
raise ConntrackOpenFailedExit(msg)
|
||||
return self
|
||||
|
|
|
@ -22,7 +22,6 @@ from oslo_config import cfg
|
|||
from oslo_log import helpers as log_helpers
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron_fwaas._i18n import _, _LE
|
||||
from neutron_fwaas.common import fwaas_constants
|
||||
from neutron_fwaas.common import resources as f_resources
|
||||
from neutron_fwaas.services.firewall.agents import firewall_agent_api as api
|
||||
|
@ -93,8 +92,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
fwaas_plugin_configured = (fwaas_constants.FIREWALL
|
||||
in self.neutron_service_plugins)
|
||||
if fwaas_plugin_configured and not self.fwaas_enabled:
|
||||
msg = _("FWaaS plugin is configured in the server side, but "
|
||||
"FWaaS is disabled in L3-agent.")
|
||||
msg = ("FWaaS plugin is configured in the server side, but "
|
||||
"FWaaS is disabled in L3-agent.")
|
||||
LOG.error(msg)
|
||||
raise SystemExit(1)
|
||||
self.fwaas_enabled = self.fwaas_enabled and fwaas_plugin_configured
|
||||
|
@ -123,7 +122,7 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
|
||||
def _get_routers_in_project(self, project_id):
|
||||
if self.agent_api is None:
|
||||
LOG.exception(_LE("FWaaS RPC call failed; L3 agent_api failure"))
|
||||
LOG.exception("FWaaS RPC call failed; L3 agent_api failure")
|
||||
router_info = self.agent_api._router_info
|
||||
if project_id:
|
||||
return [ri for ri in router_info.values()
|
||||
|
@ -152,8 +151,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
ctx,
|
||||
fw['id'])
|
||||
except fw_ext.FirewallInternalDriverError:
|
||||
LOG.error(_LE("Firewall Driver Error on fw state %(fwmsg)s "
|
||||
"for fw: %(fwid)s"),
|
||||
LOG.error("Firewall Driver Error on fw state %(fwmsg)s "
|
||||
"for fw: %(fwid)s",
|
||||
{'fwmsg': fw['status'], 'fwid': fw['id']})
|
||||
self.fwplugin_rpc.set_firewall_status(
|
||||
ctx,
|
||||
|
@ -171,8 +170,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
else:
|
||||
status = nl_constants.DOWN
|
||||
except fw_ext.FirewallInternalDriverError:
|
||||
LOG.error(_LE("Firewall Driver Error on fw state %(fwmsg)s "
|
||||
"for fw: %(fwid)s"),
|
||||
LOG.error("Firewall Driver Error on fw state %(fwmsg)s "
|
||||
"for fw: %(fwid)s",
|
||||
{'fwmsg': fw['status'], 'fwid': fw['id']})
|
||||
status = nl_constants.ERROR
|
||||
|
||||
|
@ -220,8 +219,7 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
self._process_router_add(new_router)
|
||||
except Exception:
|
||||
LOG.exception(
|
||||
_LE("FWaaS RPC info call failed for '%s'."),
|
||||
new_router['id'])
|
||||
"FWaaS RPC info call failed for '%s'.", new_router['id'])
|
||||
self.services_sync_needed = True
|
||||
|
||||
def update_router(self, context, updated_router):
|
||||
|
@ -261,7 +259,7 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
self.update_firewall(ctx, fw, self.host)
|
||||
self.services_sync_needed = False
|
||||
except Exception:
|
||||
LOG.exception(_LE("Failed fwaas process services sync"))
|
||||
LOG.exception("Failed fwaas process services sync")
|
||||
self.services_sync_needed = True
|
||||
|
||||
@log_helpers.log_method_call
|
||||
|
@ -287,9 +285,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
else:
|
||||
status = nl_constants.DOWN
|
||||
except fw_ext.FirewallInternalDriverError:
|
||||
LOG.error(_LE("Firewall Driver Error for create_firewall "
|
||||
"for firewall: %(fwid)s"),
|
||||
{'fwid': firewall['id']})
|
||||
LOG.error("Firewall Driver Error for create_firewall "
|
||||
"for firewall: %s", firewall['id'])
|
||||
status = nl_constants.ERROR
|
||||
|
||||
try:
|
||||
|
@ -299,10 +296,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
firewall['id'],
|
||||
status)
|
||||
except Exception:
|
||||
LOG.exception(
|
||||
_LE("FWaaS RPC failure in create_firewall "
|
||||
"for firewall: %(fwid)s"),
|
||||
{'fwid': firewall['id']})
|
||||
LOG.exception("FWaaS RPC failure in create_firewall "
|
||||
"for firewall: %s", firewall['id'])
|
||||
self.services_sync_needed = True
|
||||
|
||||
@log_helpers.log_method_call
|
||||
|
@ -336,10 +331,9 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
else:
|
||||
status = nl_constants.DOWN
|
||||
except fw_ext.FirewallInternalDriverError:
|
||||
LOG.error(_LE("Firewall Driver Error for "
|
||||
"update_firewall for firewall: "
|
||||
"%(fwid)s"),
|
||||
{'fwid': firewall['id']})
|
||||
LOG.error(
|
||||
"Firewall Driver Error for "
|
||||
"update_firewall for firewall: %s", firewall['id'])
|
||||
status = nl_constants.ERROR
|
||||
|
||||
# handle the add router and/or rule, policy, firewall
|
||||
|
@ -363,10 +357,9 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
else:
|
||||
status = nl_constants.DOWN
|
||||
except fw_ext.FirewallInternalDriverError:
|
||||
LOG.error(_LE("Firewall Driver Error for "
|
||||
"update_firewall for firewall: "
|
||||
"%(fwid)s"),
|
||||
{'fwid': firewall['id']})
|
||||
LOG.error(
|
||||
"Firewall Driver Error for "
|
||||
"update_firewall for firewall: %s", firewall['id'])
|
||||
status = nl_constants.ERROR
|
||||
else:
|
||||
status = nl_constants.INACTIVE
|
||||
|
@ -377,10 +370,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
firewall['id'],
|
||||
status)
|
||||
except Exception:
|
||||
LOG.exception(
|
||||
_LE("FWaaS RPC failure in update_firewall "
|
||||
"for firewall: %(fwid)s"),
|
||||
{'fwid': firewall['id']})
|
||||
LOG.exception("FWaaS RPC failure in update_firewall "
|
||||
"for firewall: %s", firewall['id'])
|
||||
self.services_sync_needed = True
|
||||
|
||||
@log_helpers.log_method_call
|
||||
|
@ -408,9 +399,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
else:
|
||||
status = nl_constants.DOWN
|
||||
except fw_ext.FirewallInternalDriverError:
|
||||
LOG.error(_LE("Firewall Driver Error for delete_firewall "
|
||||
"for firewall: %(fwid)s"),
|
||||
{'fwid': firewall['id']})
|
||||
LOG.error("Firewall Driver Error for delete_firewall "
|
||||
"for firewall: %s", firewall['id'])
|
||||
status = nl_constants.ERROR
|
||||
|
||||
try:
|
||||
|
@ -423,10 +413,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
firewall['id'],
|
||||
status)
|
||||
except Exception:
|
||||
LOG.exception(
|
||||
_LE("FWaaS RPC failure in delete_firewall "
|
||||
"for firewall: %(fwid)s"),
|
||||
{'fwid': firewall['id']})
|
||||
LOG.exception("FWaaS RPC failure in delete_firewall "
|
||||
"for firewall: %s", firewall['id'])
|
||||
self.services_sync_needed = True
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ from oslo_config import cfg
|
|||
from oslo_log import helpers as log_helpers
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron_fwaas._i18n import _, _LE
|
||||
from neutron_fwaas.common import fwaas_constants
|
||||
from neutron_fwaas.common import resources as f_resources
|
||||
from neutron_fwaas.extensions import firewall as fw_ext
|
||||
|
@ -110,8 +109,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
fwaas_plugin_configured = (fwaas_constants.FIREWALL
|
||||
in self.neutron_service_plugins)
|
||||
if fwaas_plugin_configured and not self.fwaas_enabled:
|
||||
msg = _("FWaaS plugin is configured in the server side, but "
|
||||
"FWaaS is disabled in L3-agent.")
|
||||
msg = ("FWaaS plugin is configured in the server side, but "
|
||||
"FWaaS is disabled in L3-agent.")
|
||||
LOG.error(msg)
|
||||
raise SystemExit(1)
|
||||
self.fwaas_enabled = self.fwaas_enabled and fwaas_plugin_configured
|
||||
|
@ -195,8 +194,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
self.fwplugin_rpc.firewall_group_deleted(
|
||||
ctx, firewall_group['id'])
|
||||
except fw_ext.FirewallInternalDriverError:
|
||||
msg = _LE("FWaaS driver error on %(status)s "
|
||||
"for firewall group: %(fwg_id)s")
|
||||
msg = ("FWaaS driver error on %(status)s "
|
||||
"for firewall group: %(fwg_id)s")
|
||||
LOG.exception(msg, {'status': firewall_group['status'],
|
||||
'fwg_id': firewall_group['id']})
|
||||
self.fwplugin_rpc.set_firewall_group_status(
|
||||
|
@ -215,9 +214,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
self.fwaas_driver.update_firewall_group(
|
||||
self.conf.agent_mode, port_list, firewall_group)
|
||||
except fw_ext.FirewallInternalDriverError:
|
||||
msg = _LE("FWaaS driver error on %(status)s for firewall "
|
||||
"group: "
|
||||
"%(fwg_id)s")
|
||||
msg = ("FWaaS driver error on %(status)s for firewall "
|
||||
"group: %(fwg_id)s")
|
||||
LOG.exception(msg, {'status': firewall_group['status'],
|
||||
'fwg_id': firewall_group['id']})
|
||||
status = nl_constants.ERROR
|
||||
|
@ -267,8 +265,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
try:
|
||||
self._process_router_update(new_router)
|
||||
except Exception:
|
||||
LOG.exception(_LE("FWaaS router add RPC info call failed for %s"),
|
||||
new_router['id'])
|
||||
LOG.exception("FWaaS router add RPC info call failed for %s",
|
||||
new_router['id'])
|
||||
self.services_sync_needed = True
|
||||
|
||||
def update_router(self, context, updated_router):
|
||||
|
@ -283,8 +281,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
except Exception:
|
||||
#TODO(njohnston): This repr should be replaced.
|
||||
LOG.exception(
|
||||
_LE("FWaaS router update RPC info call failed for %s"),
|
||||
repr(updated_router))
|
||||
"FWaaS router update RPC info call failed for %s",
|
||||
repr(updated_router))
|
||||
self.services_sync_needed = True
|
||||
|
||||
def delete_router(self, context, new_router):
|
||||
|
@ -323,7 +321,7 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
self.host)
|
||||
self.services_sync_needed = False
|
||||
except Exception:
|
||||
LOG.exception(_LE("Failed FWaaS process services sync."))
|
||||
LOG.exception("Failed FWaaS process services sync.")
|
||||
self.services_sync_needed = True
|
||||
|
||||
@log_helpers.log_method_call
|
||||
|
@ -354,8 +352,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
ports_for_fwg,
|
||||
firewall_group)
|
||||
except fw_ext.FirewallInternalDriverError:
|
||||
msg = _LE("FWaaS driver error in create_firewall_group "
|
||||
"for firewall group: %(fwg_id)s")
|
||||
msg = ("FWaaS driver error in create_firewall_group "
|
||||
"for firewall group: %(fwg_id)s")
|
||||
LOG.exception(msg, {'fwg_id': firewall_group['id']})
|
||||
status = nl_constants.ERROR
|
||||
|
||||
|
@ -364,8 +362,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
self.fwplugin_rpc.set_firewall_group_status(context,
|
||||
firewall_group['id'], status)
|
||||
except Exception:
|
||||
msg = _LE("FWaaS RPC failure in create_firewall_group "
|
||||
"for firewall group: %(fwg_id)s")
|
||||
msg = ("FWaaS RPC failure in create_firewall_group "
|
||||
"for firewall group: %(fwg_id)s")
|
||||
LOG.exception(msg, {'fwg_id': firewall_group['id']})
|
||||
self.services_sync_needed = True
|
||||
|
||||
|
@ -406,8 +404,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
ports_for_fwg,
|
||||
firewall_group)
|
||||
except fw_ext.FirewallInternalDriverError:
|
||||
msg = _LE("FWaaS driver error in update_firewall_group "
|
||||
"(add) for firewall group: %s")
|
||||
msg = ("FWaaS driver error in update_firewall_group "
|
||||
"(add) for firewall group: %s")
|
||||
LOG.exception(msg, firewall_group['id'])
|
||||
status = nl_constants.ERROR
|
||||
|
||||
|
@ -437,8 +435,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
self.conf.agent_mode, ports_for_fwg,
|
||||
firewall_group)
|
||||
except fw_ext.FirewallInternalDriverError:
|
||||
msg = _LE("FWaaS driver error in update_firewall_group "
|
||||
"for firewall group: %s")
|
||||
msg = ("FWaaS driver error in update_firewall_group "
|
||||
"for firewall group: %s")
|
||||
LOG.exception(msg, firewall_group['id'])
|
||||
status = nl_constants.ERROR
|
||||
else:
|
||||
|
@ -449,9 +447,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
self.fwplugin_rpc.set_firewall_group_status(context,
|
||||
firewall_group['id'], status)
|
||||
except Exception:
|
||||
LOG.exception(_LE("FWaaS RPC failure in update_firewall_group "
|
||||
"for firewall group: %(fwg_id)s"),
|
||||
{'fwg_id': firewall_group['id']})
|
||||
LOG.exception("FWaaS RPC failure in update_firewall_group "
|
||||
"for firewall group: %s", firewall_group['id'])
|
||||
self.services_sync_needed = True
|
||||
|
||||
@log_helpers.log_method_call
|
||||
|
@ -482,9 +479,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
firewall_group)
|
||||
# Call the driver.
|
||||
except fw_ext.FirewallInternalDriverError:
|
||||
LOG.exception(_LE("FWaaS driver error in delete_firewall_group "
|
||||
"for firewall group: %(fwg_id)s"),
|
||||
{'fwg_id': firewall_group['id']})
|
||||
LOG.exception("FWaaS driver error in delete_firewall_group "
|
||||
"for firewall group: %s", firewall_group['id'])
|
||||
status = nl_constants.ERROR
|
||||
|
||||
# Notify plugin of deletion or return firewall group's status to
|
||||
|
@ -497,9 +493,8 @@ class FWaaSL3AgentExtension(l3_extension.L3AgentExtension):
|
|||
self.fwplugin_rpc.set_firewall_group_status(context,
|
||||
firewall_group['id'], status)
|
||||
except Exception:
|
||||
LOG.exception(_LE("FWaaS RPC failure in delete_firewall_group "
|
||||
"for firewall group: %(fwg_id)s"),
|
||||
{'fwg_id': firewall_group['id']})
|
||||
LOG.exception("FWaaS RPC failure in delete_firewall_group "
|
||||
"for firewall group: %s", firewall_group['id'])
|
||||
self.services_sync_needed = True
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ from oslo_config import cfg
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron_fwaas._i18n import _LE
|
||||
from neutron_fwaas.common import fwaas_constants as f_const
|
||||
from neutron_fwaas.services.firewall.drivers import fwaas_base
|
||||
|
||||
|
@ -79,7 +78,7 @@ class IptablesFwaasDriver(fwaas_base.FwaasDriverBase):
|
|||
driver)
|
||||
except ImportError:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.error(_LE("Driver '%s' not found."), driver)
|
||||
LOG.error("Driver '%s' not found.", driver)
|
||||
|
||||
def create_firewall(self, agent_mode, apply_list, firewall):
|
||||
LOG.debug('Creating firewall %(fw_id)s for tenant %(tid)s',
|
||||
|
@ -94,7 +93,7 @@ class IptablesFwaasDriver(fwaas_base.FwaasDriverBase):
|
|||
self.apply_default_policy(agent_mode, apply_list, firewall)
|
||||
except (LookupError, RuntimeError):
|
||||
# catch known library exceptions and raise Fwaas generic exception
|
||||
LOG.exception(_LE("Failed to create firewall: %s"), firewall['id'])
|
||||
LOG.exception("Failed to create firewall: %s", firewall['id'])
|
||||
raise f_exc.FirewallInternalDriverError(driver=FWAAS_DRIVER_NAME)
|
||||
|
||||
def _get_ipt_mgrs_with_if_prefix(self, agent_mode, router_info):
|
||||
|
@ -139,7 +138,7 @@ class IptablesFwaasDriver(fwaas_base.FwaasDriverBase):
|
|||
self.pre_firewall = None
|
||||
except (LookupError, RuntimeError):
|
||||
# catch known library exceptions and raise Fwaas generic exception
|
||||
LOG.exception(_LE("Failed to delete firewall: %s"), fwid)
|
||||
LOG.exception("Failed to delete firewall: %s", fwid)
|
||||
raise f_exc.FirewallInternalDriverError(driver=FWAAS_DRIVER_NAME)
|
||||
|
||||
def update_firewall(self, agent_mode, apply_list, firewall):
|
||||
|
@ -159,7 +158,7 @@ class IptablesFwaasDriver(fwaas_base.FwaasDriverBase):
|
|||
self.pre_firewall = dict(firewall)
|
||||
except (LookupError, RuntimeError):
|
||||
# catch known library exceptions and raise Fwaas generic exception
|
||||
LOG.exception(_LE("Failed to update firewall: %s"), firewall['id'])
|
||||
LOG.exception("Failed to update firewall: %s", firewall['id'])
|
||||
raise f_exc.FirewallInternalDriverError(driver=FWAAS_DRIVER_NAME)
|
||||
|
||||
def apply_default_policy(self, agent_mode, apply_list, firewall):
|
||||
|
@ -185,7 +184,7 @@ class IptablesFwaasDriver(fwaas_base.FwaasDriverBase):
|
|||
except (LookupError, RuntimeError):
|
||||
# catch known library exceptions and raise Fwaas generic exception
|
||||
LOG.exception(
|
||||
_LE("Failed to apply default policy on firewall: %s"), fwid)
|
||||
"Failed to apply default policy on firewall: %s", fwid)
|
||||
raise f_exc.FirewallInternalDriverError(driver=FWAAS_DRIVER_NAME)
|
||||
|
||||
def _setup_firewall(self, agent_mode, apply_list, firewall):
|
||||
|
|
|
@ -19,7 +19,6 @@ from neutron.common import utils
|
|||
from neutron_lib.api.definitions import firewall as fw_ext
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron_fwaas._i18n import _LE
|
||||
from neutron_fwaas.services.firewall.drivers import fwaas_base_v2
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -79,7 +78,7 @@ class IptablesFwaasDriver(fwaas_base_v2.FwaasDriverBase):
|
|||
self.apply_default_policy(agent_mode, apply_list, firewall)
|
||||
except (LookupError, RuntimeError):
|
||||
# catch known library exceptions and raise Fwaas generic exception
|
||||
LOG.exception(_LE("Failed to create firewall: %s"), firewall['id'])
|
||||
LOG.exception("Failed to create firewall: %s", firewall['id'])
|
||||
raise fw_ext.FirewallInternalDriverError(driver=FWAAS_DRIVER_NAME)
|
||||
|
||||
def _get_ipt_mgrs_with_if_prefix(self, agent_mode, ri):
|
||||
|
@ -124,7 +123,7 @@ class IptablesFwaasDriver(fwaas_base_v2.FwaasDriverBase):
|
|||
self.pre_firewall = None
|
||||
except (LookupError, RuntimeError):
|
||||
# catch known library exceptions and raise Fwaas generic exception
|
||||
LOG.exception(_LE("Failed to delete firewall: %s"), fwid)
|
||||
LOG.exception("Failed to delete firewall: %s", fwid)
|
||||
raise fw_ext.FirewallInternalDriverError(driver=FWAAS_DRIVER_NAME)
|
||||
|
||||
def update_firewall_group(self, agent_mode, apply_list, firewall):
|
||||
|
@ -144,7 +143,7 @@ class IptablesFwaasDriver(fwaas_base_v2.FwaasDriverBase):
|
|||
self.pre_firewall = dict(firewall)
|
||||
except (LookupError, RuntimeError):
|
||||
# catch known library exceptions and raise Fwaas generic exception
|
||||
LOG.exception(_LE("Failed to update firewall: %s"), firewall['id'])
|
||||
LOG.exception("Failed to update firewall: %s", firewall['id'])
|
||||
raise fw_ext.FirewallInternalDriverError(driver=FWAAS_DRIVER_NAME)
|
||||
|
||||
def apply_default_policy(self, agent_mode, apply_list, firewall):
|
||||
|
@ -171,7 +170,7 @@ class IptablesFwaasDriver(fwaas_base_v2.FwaasDriverBase):
|
|||
except (LookupError, RuntimeError):
|
||||
# catch known library exceptions and raise Fwaas generic exception
|
||||
LOG.exception(
|
||||
_LE("Failed to apply default policy on firewall: %s"), fwid)
|
||||
"Failed to apply default policy on firewall: %s", fwid)
|
||||
raise fw_ext.FirewallInternalDriverError(driver=FWAAS_DRIVER_NAME)
|
||||
|
||||
def _setup_firewall(self, agent_mode, apply_list, firewall):
|
||||
|
@ -296,8 +295,7 @@ class IptablesFwaasDriver(fwaas_base_v2.FwaasDriverBase):
|
|||
check_exit_code=True,
|
||||
extra_ok_codes=[1])
|
||||
except RuntimeError:
|
||||
LOG.exception(
|
||||
_LE("Failed execute conntrack command %s"), str(cmd))
|
||||
LOG.exception("Failed execute conntrack command %s", str(cmd))
|
||||
|
||||
def _remove_conntrack_new_firewall(self, agent_mode, apply_list, firewall):
|
||||
"""Remove conntrack when create new firewall"""
|
||||
|
|
|
@ -17,7 +17,6 @@ from neutron.agent.linux import utils as linux_utils
|
|||
from neutron_lib import constants
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron_fwaas._i18n import _
|
||||
from neutron_fwaas.services.firewall.drivers import conntrack_base
|
||||
|
||||
|
||||
|
@ -58,7 +57,7 @@ class ConntrackLegacy(conntrack_base.ConntrackDriverBase):
|
|||
check_exit_code=True,
|
||||
extra_ok_codes=[1])
|
||||
except RuntimeError:
|
||||
msg = _("Failed execute conntrack command %s") % cmd
|
||||
msg = "Failed execute conntrack command %s" % cmd
|
||||
raise RuntimeError(msg)
|
||||
return output
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ from oslo_config import cfg
|
|||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
|
||||
from neutron_fwaas._i18n import _LI, _LW
|
||||
from neutron_fwaas.common import fwaas_constants as f_const
|
||||
from neutron_fwaas.db.firewall import firewall_db
|
||||
from neutron_fwaas.db.firewall import firewall_router_insertion_db
|
||||
|
@ -73,13 +72,13 @@ class FirewallCallbacks(object):
|
|||
self.plugin.delete_db_firewall_object(context, firewall_id)
|
||||
return True
|
||||
else:
|
||||
LOG.warning(_LW('Firewall %(fw)s unexpectedly deleted by '
|
||||
'agent, status was %(status)s'),
|
||||
LOG.warning('Firewall %(fw)s unexpectedly deleted by '
|
||||
'agent, status was %(status)s',
|
||||
{'fw': firewall_id, 'status': fw_db.status})
|
||||
fw_db.update({"status": nl_constants.ERROR})
|
||||
return False
|
||||
except f_exc.FirewallNotFound:
|
||||
LOG.info(_LI('Firewall %s already deleted'), firewall_id)
|
||||
LOG.info('Firewall %s already deleted', firewall_id)
|
||||
return True
|
||||
|
||||
def get_firewalls_for_tenant(self, context, **kwargs):
|
||||
|
|
|
@ -25,7 +25,6 @@ from oslo_config import cfg
|
|||
from oslo_log import log as logging
|
||||
import oslo_messaging
|
||||
|
||||
from neutron_fwaas._i18n import _LI
|
||||
from neutron_fwaas.common import fwaas_constants
|
||||
from neutron_fwaas.db.firewall.v2 import firewall_db_v2
|
||||
|
||||
|
@ -112,7 +111,7 @@ class FirewallCallbacks(object):
|
|||
fwg_db.update({"status": nl_constants.ERROR})
|
||||
return False
|
||||
except f_exc.FirewallGroupNotFound:
|
||||
LOG.info(_LI('Firewall group %s already deleted'), fwg_id)
|
||||
LOG.info('Firewall group %s already deleted', fwg_id)
|
||||
return True
|
||||
|
||||
def get_firewall_groups_for_project(self, context, **kwargs):
|
||||
|
|
|
@ -30,7 +30,6 @@ import six
|
|||
import testtools
|
||||
import webob.exc
|
||||
|
||||
from neutron_fwaas._i18n import _
|
||||
from neutron_fwaas.db.firewall.v2 import firewall_db_v2 as fdb
|
||||
from neutron_fwaas import extensions
|
||||
from neutron_fwaas.services.firewall import fwaas_plugin_v2
|
||||
|
@ -108,8 +107,8 @@ class FirewallPluginV2DbTestCase(base.NeutronDbPluginV2TestCase):
|
|||
cfg.BoolOpt(
|
||||
'router_distributed',
|
||||
default=False,
|
||||
help=_("System-wide flag to determine the type of router "
|
||||
"that tenants can create. Only admin can override.")),
|
||||
help=("System-wide flag to determine the type of router "
|
||||
"that tenants can create. Only admin can override.")),
|
||||
]
|
||||
cfg.CONF.register_opts(router_distributed_opts)
|
||||
|
||||
|
|
3
tox.ini
3
tox.ini
|
@ -91,11 +91,10 @@ commands = python setup.py build_sphinx
|
|||
# TODO(dougwig) -- uncomment this to test for remaining linkages
|
||||
# N530 direct neutron imports not allowed
|
||||
# TODO(ihrachys) -- reenable N537 when new neutron-lib release is available
|
||||
# N537 Log messages should not be translated
|
||||
# H106: Do not put vim configuration in source files
|
||||
# H203: Use assertIs(Not)None to check for None
|
||||
# H904: Delay string interpolations at logging calls
|
||||
ignore = E125,E126,E128,E129,E265,H404,H405,N530,N537
|
||||
ignore = E125,E126,E128,E129,E265,H404,H405,N530
|
||||
enable-extensions=H106,H203,H904
|
||||
show-source = true
|
||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,.tmp,*egg,build,tools,.ropeproject,rally-scenarios
|
||||
|
|
Loading…
Reference in New Issue