Fix pep8 issues

Change-Id: I673536bdb0d769de7e5e8f3e0dd315d81c6d23fe
This commit is contained in:
Kobi Samoray 2021-07-01 13:46:58 +03:00
parent 03821d9534
commit e28f9c13fb
12 changed files with 27 additions and 26 deletions

View File

@ -101,7 +101,9 @@ disable=
invalid-overridden-method,
raising-format-tuple,
comparison-with-callable,
consider-using-with
consider-using-with,
unused-private-member,
arguments-renamed,
[BASIC]
# Variable names can be 1 to 31 characters long, with lowercase and underscores

View File

@ -450,10 +450,10 @@ class ApiReplayClient(utils.PrepareObjectForMigration):
# Create the rules after all security groups are created to allow
# dependencies in remote_group_id
for sg_id in rules_dict:
for sg_id, sg in rules_dict.items():
try:
rules = self.dest_neutron.create_security_group_rule(
{'security_group_rules': rules_dict[sg_id]})
{'security_group_rules': sg})
LOG.info("Created %d security group rules for SG %s: %s",
len(rules), sg_id,
",".join([rule.get('id') for rule in

View File

@ -197,15 +197,15 @@ class NsxTVDPlugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
def init_extensions(self):
# Support all the extensions supported by any of the plugins
extensions = []
for plugin in self.plugins:
extensions.extend(self.plugins[plugin].supported_extension_aliases)
for plugin in self.plugins.values():
extensions.extend(plugin.supported_extension_aliases)
self.supported_extension_aliases.extend(list(set(extensions)))
# mark extensions which are supported by only one of the plugins
self._unsupported_fields = {}
for plugin in self.plugins:
for plugin in self.plugins.values():
# TODO(asarfaty): add other resources here
plugin_type = self.plugins[plugin].plugin_type()
plugin_type = plugin.plugin_type()
self._unsupported_fields[plugin_type] = {'router': [],
'port': [],
'security_group': []}
@ -290,8 +290,7 @@ class NsxTVDPlugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
def start_rpc_listeners(self):
# Run the start_rpc_listeners of one of the sub-plugins
for plugin_type in self.plugins:
plugin = self.plugins[plugin_type]
for plugin in self.plugins.values():
if plugin.rpc_workers_supported():
return plugin.start_rpc_listeners()

View File

@ -453,20 +453,20 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
NO_SLAAC_NDRA_PROFILE_ID: policy_constants.IPV6_RA_MODE_DISABLED
}
for profile in ndra_profiles:
for profile_key, profile_value in ndra_profiles.items():
try:
self.nsxpolicy.ipv6_ndra_profile.get(profile, silent=True)
self.nsxpolicy.ipv6_ndra_profile.get(profile_key, silent=True)
except nsx_lib_exc.ResourceNotFound:
try:
self.nsxpolicy.ipv6_ndra_profile.create_or_overwrite(
profile,
profile_id=profile,
ra_mode=ndra_profiles[profile],
profile_key,
profile_id=profile_key,
ra_mode=profile_value,
tags=self.nsxpolicy.build_v3_api_version_tag())
except nsx_lib_exc.StaleRevision as e:
# This means that another controller is also creating this
LOG.info("Failed to configure ipv6_ndra_profile %s: %s",
profile, e)
profile_key, e)
self.client_ssl_profile = None

View File

@ -217,12 +217,11 @@ class TaskManager(object):
def _check_pending_tasks(self):
"""Check all pending tasks status."""
for resource_id in self._tasks.keys():
for resource_id, tasks in self._tasks.items():
if self._stopped:
# Task manager is stopped, return now
return
tasks = self._tasks[resource_id]
# only the first task is executed and pending
task = tasks[0]
try:

View File

@ -108,7 +108,8 @@ class NsxAbstractIpamDriver(subnet_alloc.SubnetAllocator, NsxIpamBase):
# override the OOB factory to add the network ID
return NsxSubnetRequestFactory
@abc.abstractproperty
@property
@abc.abstractmethod
def _subnet_class(self):
"""Return the class of the subnet that should be used."""
pass

View File

@ -424,8 +424,8 @@ def stats_getter(context, core_plugin, ignore_list=None):
stats['id'] = p_utils.path_to_id(
vs['virtual_server_path'])
stats['request_errors'] = 0 # currently unsupported
for stat in lb_const.LB_STATS_MAP:
lb_stat = lb_const.LB_STATS_MAP[stat]
for stat, stat_value in lb_const.LB_STATS_MAP.items():
lb_stat = stat_value
stats[stat] += vs_stats[lb_stat]
stat_list.append(stats)

View File

@ -431,8 +431,8 @@ def stats_getter(context, core_plugin, ignore_list=None):
stats = copy.copy(lb_const.LB_EMPTY_STATS)
stats['id'] = vs_bind.listener_id
stats['request_errors'] = 0 # currently unsupported
for stat in lb_const.LB_STATS_MAP:
lb_stat = lb_const.LB_STATS_MAP[stat]
for stat, stat_value in lb_const.LB_STATS_MAP.items():
lb_stat = stat_value
stats[stat] += vs_stats[lb_stat]
stat_list.append(stats)

View File

@ -28,7 +28,7 @@ from vmware_nsx.plugins.nsx_v.vshield import edge_utils
from vmware_nsx.shell.admin.plugins.common import constants
from vmware_nsx.shell.admin.plugins.common import formatters
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils
import vmware_nsx.shell.admin.plugins.nsxv.resources.utils as utils
from vmware_nsx.shell.admin.plugins.nsxv.resources import utils
import vmware_nsx.shell.resources as shell

View File

@ -21,7 +21,7 @@ from oslo_log import log as logging
from vmware_nsx.shell.admin.plugins.common import constants
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils
import vmware_nsx.shell.admin.plugins.nsxv.resources.utils as utils
from vmware_nsx.shell.admin.plugins.nsxv.resources import utils
import vmware_nsx.shell.resources as shell
from neutron_lib.callbacks import registry

View File

@ -16,7 +16,7 @@
from vmware_nsx.shell.admin.plugins.common import constants
from vmware_nsx.shell.admin.plugins.common import formatters
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils
import vmware_nsx.shell.admin.plugins.nsxv.resources.utils as utils
from vmware_nsx.shell.admin.plugins.nsxv.resources import utils
import vmware_nsx.shell.resources as shell
from neutron_lib.callbacks import registry

View File

@ -17,7 +17,7 @@ from vmware_nsx.shell.admin.plugins.common import constants
from vmware_nsx.shell.admin.plugins.common import formatters
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils
import vmware_nsx.shell.admin.plugins.nsxv.resources.utils as utils
from vmware_nsx.shell.admin.plugins.nsxv.resources import utils
import vmware_nsx.shell.resources as shell
from neutron_lib.callbacks import registry