From 14cb886809e5cccbf799a0dc2e5b99f31b1ab3be Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Fri, 21 Feb 2014 21:15:19 +0900 Subject: [PATCH] Use "!=" instead of "is not" when comparing two values Change-Id: I2cd9575585dde7c44b528077a7bffa16379b1759 Closes-Bug: #1283019 --- neutron/agent/common/config.py | 4 ++-- neutron/plugins/bigswitch/plugin.py | 2 +- .../plugins/linuxbridge/agent/linuxbridge_neutron_agent.py | 2 +- neutron/plugins/nec/nec_plugin.py | 6 +++--- neutron/tests/unit/test_extension_portsecurity.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/neutron/agent/common/config.py b/neutron/agent/common/config.py index 9d5f5b1c4..4bf3710ee 100644 --- a/neutron/agent/common/config.py +++ b/neutron/agent/common/config.py @@ -78,11 +78,11 @@ def register_agent_state_opts_helper(conf): def get_root_helper(conf): root_helper = conf.AGENT.root_helper - if root_helper is not 'sudo': + if root_helper != 'sudo': return root_helper root_helper = conf.root_helper - if root_helper is not 'sudo': + if root_helper != 'sudo': LOG.deprecated(_('DEFAULT.root_helper is deprecated! Please move ' 'root_helper configuration to [AGENT] section.')) return root_helper diff --git a/neutron/plugins/bigswitch/plugin.py b/neutron/plugins/bigswitch/plugin.py index d0bc7d46e..e1f9f32e9 100644 --- a/neutron/plugins/bigswitch/plugin.py +++ b/neutron/plugins/bigswitch/plugin.py @@ -262,7 +262,7 @@ class NeutronRestProxyV2Base(db_base_plugin_v2.NeutronDbPluginV2, "resource: %s"), resource) if 'status' in resource: - if resource['status'] is not const.NET_STATUS_ACTIVE: + if resource['status'] != const.NET_STATUS_ACTIVE: LOG.warning(_("Operational status is internally set by the " "plugin. Ignoring setting status=%s."), resource['status']) diff --git a/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py b/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py index 3b5ec31a4..6bf1e05d2 100755 --- a/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py +++ b/neutron/plugins/linuxbridge/agent/linuxbridge_neutron_agent.py @@ -781,7 +781,7 @@ class LinuxBridgeNeutronAgentRPC(sg_rpc.SecurityGroupAgentRpcMixin): self.root_helper = root_helper self.setup_linux_bridge(interface_mappings) configurations = {'interface_mappings': interface_mappings} - if self.br_mgr.vxlan_mode is not lconst.VXLAN_NONE: + if self.br_mgr.vxlan_mode != lconst.VXLAN_NONE: configurations['tunneling_ip'] = self.br_mgr.local_ip configurations['tunnel_types'] = [p_const.TYPE_VXLAN] configurations['l2_population'] = cfg.CONF.VXLAN.l2_population diff --git a/neutron/plugins/nec/nec_plugin.py b/neutron/plugins/nec/nec_plugin.py index 41aaf61f7..b57a7ec08 100644 --- a/neutron/plugins/nec/nec_plugin.py +++ b/neutron/plugins/nec/nec_plugin.py @@ -227,7 +227,7 @@ class NECPluginV2(db_base_plugin_v2.NeutronDbPluginV2, LOG.error(_("create_ofc_port() failed due to %s"), exc) port_status = const.PORT_STATUS_ERROR - if port_status is not port['status']: + if port_status != port['status']: self._update_resource_status(context, "port", port['id'], port_status) port['status'] = port_status @@ -248,7 +248,7 @@ class NECPluginV2(db_base_plugin_v2.NeutronDbPluginV2, LOG.error(_("delete_ofc_port() failed due to %s"), exc) port_status = const.PORT_STATUS_ERROR - if port_status is not port['status']: + if port_status != port['status']: self._update_resource_status(context, "port", port['id'], port_status) port['status'] = port_status @@ -313,7 +313,7 @@ class NECPluginV2(db_base_plugin_v2.NeutronDbPluginV2, network) self._process_l3_update(context, new_net, network['network']) - changed = (old_net['admin_state_up'] is not new_net['admin_state_up']) + changed = (old_net['admin_state_up'] != new_net['admin_state_up']) if changed and not new_net['admin_state_up']: # disable all active ports of the network filters = dict(network_id=[id], status=[const.PORT_STATUS_ACTIVE]) diff --git a/neutron/tests/unit/test_extension_portsecurity.py b/neutron/tests/unit/test_extension_portsecurity.py index a90e7a2cb..c336db23a 100644 --- a/neutron/tests/unit/test_extension_portsecurity.py +++ b/neutron/tests/unit/test_extension_portsecurity.py @@ -136,7 +136,7 @@ class PortSecurityTestPlugin(db_base_plugin_v2.NeutronDbPluginV2, # Port security/IP was updated off. Need to check that no security # groups are on port. - if (ret_port[psec.PORTSECURITY] is not True or not has_ip): + if (ret_port[psec.PORTSECURITY] != True or not has_ip): if has_security_groups: raise psec.PortSecurityAndIPRequiredForSecurityGroups() -- 2.45.2