Fix unit tests and pylint checks

1) Use registry_publish in place of registry_notify
2) Fix usage of dict() [R1735]
3) Ignore unspecified-encoding [W1514]

Change-Id: I1c7b34bf43b947a25bf72ba32db0ce142a4bcc01
This commit is contained in:
Salvatore Orlando 2021-08-23 03:47:55 -07:00
parent 53e7bb6ab8
commit f38f0f30d9
6 changed files with 6 additions and 5 deletions

View File

@ -41,6 +41,7 @@ disable=
super-init-not-called, super-init-not-called,
super-on-old-class, super-on-old-class,
unpacking-non-sequence, unpacking-non-sequence,
unspecified-encoding,
unused-argument, unused-argument,
unused-import, unused-import,
unused-variable, unused-variable,

View File

@ -1041,7 +1041,7 @@ register_nsxp_azs(cfg.CONF, cfg.CONF.nsx_p.availability_zones)
def _get_nsx_az_opts(az, opts): def _get_nsx_az_opts(az, opts):
az_info = dict() az_info = {}
group = 'az:%s' % az group = 'az:%s' % az
if group not in cfg.CONF: if group not in cfg.CONF:
raise nsx_exc.NsxInvalidConfiguration( raise nsx_exc.NsxInvalidConfiguration(

View File

@ -91,7 +91,7 @@ class ExtendedSecurityGroupPropertiesMixin(object):
'is_default': default_sg, 'is_default': default_sg,
} }
self._registry_notify(resources.SECURITY_GROUP, events.BEFORE_CREATE, self._registry_publish(resources.SECURITY_GROUP, events.BEFORE_CREATE,
exc_cls=ext_sg.SecurityGroupConflict, exc_cls=ext_sg.SecurityGroupConflict,
payload=events.DBEventPayload( payload=events.DBEventPayload(
context, metadata={'is_default': default_sg}, context, metadata={'is_default': default_sg},

View File

@ -72,7 +72,7 @@ def run_migrations_offline():
""" """
set_mysql_engine() set_mysql_engine()
kwargs = dict() kwargs = {}
if neutron_config.database.connection: if neutron_config.database.connection:
kwargs['url'] = neutron_config.database.connection kwargs['url'] = neutron_config.database.connection
else: else:

View File

@ -64,7 +64,7 @@ class Lsn(api_extensions.ExtensionDescriptor):
plugin = directory.get_plugin() plugin = directory.get_plugin()
resource_name = ALIAS resource_name = ALIAS
collection_name = resource_name.replace('_', '-') + "s" collection_name = resource_name.replace('_', '-') + "s"
params = RESOURCE_ATTRIBUTE_MAP.get(COLLECTION_NAME, dict()) params = RESOURCE_ATTRIBUTE_MAP.get(COLLECTION_NAME, {})
controller = base.create_resource(collection_name, controller = base.create_resource(collection_name,
resource_name, resource_name,
plugin, params, allow_bulk=False) plugin, params, allow_bulk=False)

View File

@ -47,7 +47,7 @@ def output_header(func):
def parse_multi_keyval_opt(opt_list): def parse_multi_keyval_opt(opt_list):
"""Converts a MutliStrOpt to a key-value dict""" """Converts a MutliStrOpt to a key-value dict"""
result = dict() result = {}
opt_list = opt_list if opt_list else [] opt_list = opt_list if opt_list else []
for opt_value in opt_list: for opt_value in opt_list:
try: try: