do not use str(url) to stringify a URL for subsequent use

The str(url) function in SQLAlchemy hides the password.
For a URL string that is to be re-used, use
render_as_string(hide_password=False).

Also bump pylint to fix the command being stuck. Sync .pylint to
neutron to fix the failures caused by the old removed options.

Co-Authored-By: Mike Bayer <mike_mp@zzzcomputing.com>
Change-Id: Iba3664d2954e38d8730026b83765140eea001cf7
This commit is contained in:
Takashi Kajinami 2024-05-21 00:32:58 +09:00
parent 50dcf3d121
commit 8ef9750730
5 changed files with 60 additions and 51 deletions

View File

@ -1,12 +1,16 @@
# The format of this file isn't really documented; just use --generate-rcfile # The format of this file isn't really documented; just use --generate-rcfile
[MASTER] [MAIN]
# Add <file or directory> to the black list. It should be a base name, not a # Add <file or directory> to the black list. It should be a base name, not a
# path. You may set this option multiple times. # path. You may set this option multiple times.
# ignore=.git,tests
# Note the 'openstack' below is intended to match only
# neutron.openstack.common. If we ever have another 'openstack' # List of plugins (as comma separated values of python module names) to load,
# dirname, then we'll need to expand the ignore features in pylint :/ # usually to register additional checkers.
ignore=.git,tests,openstack load-plugins=pylint.extensions.no_self_use
# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes
[MESSAGES CONTROL] [MESSAGES CONTROL]
# NOTE(gus): This is a long list. A number of these are important and # NOTE(gus): This is a long list. A number of these are important and
@ -16,69 +20,63 @@ disable=
# "F" Fatal errors that prevent further processing # "F" Fatal errors that prevent further processing
import-error, import-error,
# "I" Informational noise # "I" Informational noise
c-extension-no-member,
locally-disabled, locally-disabled,
# "E" Error for important programming issues (likely bugs) # "E" Error for important programming issues (likely bugs)
access-member-before-definition, access-member-before-definition,
bad-super-call,
maybe-no-member,
no-member, no-member,
no-method-argument, no-method-argument,
no-self-argument, no-self-argument,
not-callable, not-an-iterable,
no-value-for-parameter, possibly-used-before-assignment,
super-on-old-class,
too-few-format-args,
# "W" Warnings for stylistic problems or minor programming issues # "W" Warnings for stylistic problems or minor programming issues
abstract-method, abstract-method,
anomalous-backslash-in-string,
anomalous-unicode-escape-in-string,
arguments-differ, arguments-differ,
attribute-defined-outside-init, attribute-defined-outside-init,
bad-builtin,
bad-indentation,
broad-except, broad-except,
dangerous-default-value,
deprecated-lambda,
expression-not-assigned, expression-not-assigned,
fixme, fixme,
global-statement, global-statement,
global-variable-not-assigned,
logging-not-lazy,
no-init,
non-parent-init-called, non-parent-init-called,
pointless-string-statement, not-callable,
protected-access, protected-access,
redefined-builtin, redefined-builtin,
redefined-outer-name, redefined-outer-name,
redefine-in-handler,
signature-differs, signature-differs,
star-args,
super-init-not-called, super-init-not-called,
unnecessary-lambda,
unnecessary-pass,
unpacking-non-sequence, unpacking-non-sequence,
unreachable,
unused-argument, unused-argument,
unused-import, unused-import,
unused-variable, unused-variable,
# TODO(dougwig) - disable nonstandard-exception while we have neutron_lib shims useless-super-delegation,
nonstandard-exception, unnecessary-pass,
raise-missing-from,
arguments-renamed,
broad-exception-raised,
unspecified-encoding,
redundant-u-string-prefix,
unused-private-member,
# "C" Coding convention violations # "C" Coding convention violations
bad-continuation, consider-iterating-dictionary,
consider-using-enumerate,
invalid-name, invalid-name,
len-as-condition,
missing-docstring, missing-docstring,
old-style-class, singleton-comparison,
superfluous-parens, superfluous-parens,
ungrouped-imports,
wrong-import-order,
consider-using-f-string,
consider-using-dict-items,
# "R" Refactor recommendations # "R" Refactor recommendations
abstract-class-little-used, consider-merging-isinstance,
abstract-class-not-used, consider-using-ternary,
consider-using-set-comprehension,
duplicate-code, duplicate-code,
inconsistent-return-statements, inconsistent-return-statements,
interface-not-implemented,
no-else-raise,
no-else-return, no-else-return,
no-self-use, no-self-use,
redefined-argument-from-local,
simplifiable-if-statement,
too-few-public-methods, too-few-public-methods,
too-many-ancestors, too-many-ancestors,
too-many-arguments, too-many-arguments,
@ -86,10 +84,14 @@ disable=
too-many-instance-attributes, too-many-instance-attributes,
too-many-lines, too-many-lines,
too-many-locals, too-many-locals,
too-many-nested-blocks,
too-many-public-methods, too-many-public-methods,
too-many-return-statements, too-many-return-statements,
too-many-statements, too-many-statements,
useless-object-inheritance consider-using-set-comprehension,
useless-object-inheritance,
super-with-arguments,
use-dict-literal
[BASIC] [BASIC]
# Variable names can be 1 to 31 characters long, with lowercase and underscores # Variable names can be 1 to 31 characters long, with lowercase and underscores
@ -99,7 +101,7 @@ variable-rgx=[a-z_][a-z0-9_]{0,30}$
argument-rgx=[a-z_][a-z0-9_]{1,30}$ argument-rgx=[a-z_][a-z0-9_]{1,30}$
# Method names should be at least 3 characters long # Method names should be at least 3 characters long
# and be lowecased with underscores # and be lowercased with underscores
method-rgx=([a-z_][a-z0-9_]{2,}|setUp|tearDown)$ method-rgx=([a-z_][a-z0-9_]{2,}|setUp|tearDown)$
# Module names matching neutron-* are ok (files in bin/) # Module names matching neutron-* are ok (files in bin/)
@ -119,18 +121,22 @@ max-line-length=79
additional-builtins=_ additional-builtins=_
[CLASSES] [CLASSES]
# List of interface methods to ignore, separated by a comma. # List of valid names for the first argument in a class method.
ignore-iface-methods= valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=cls
[IMPORTS] [IMPORTS]
# Deprecated modules which should not be used, separated by a comma # Deprecated modules which should not be used, separated by a comma
deprecated-modules= deprecated-modules=
# should use openstack.common.jsonutils # should use oslo_serialization.jsonutils
json json,
six
[TYPECHECK] [TYPECHECK]
# List of module names for which member attributes should not be checked # List of module names for which member attributes should not be checked
ignored-modules=six.moves,_MovedItems ignored-modules=_MovedItems
[REPORTS] [REPORTS]
# Tells whether to display a full report or only the messages # Tells whether to display a full report or only the messages

View File

@ -72,14 +72,14 @@ class VPNPluginDb(vpnaas.VPNPluginBase,
raise vpn_exception.IPsecSiteConnectionNotFound( raise vpn_exception.IPsecSiteConnectionNotFound(
ipsec_site_conn_id=v_id ipsec_site_conn_id=v_id
) )
elif issubclass(model, vpn_models.IKEPolicy): if issubclass(model, vpn_models.IKEPolicy):
raise vpn_exception.IKEPolicyNotFound(ikepolicy_id=v_id) raise vpn_exception.IKEPolicyNotFound(ikepolicy_id=v_id)
elif issubclass(model, vpn_models.IPsecPolicy): if issubclass(model, vpn_models.IPsecPolicy):
raise vpn_exception.IPsecPolicyNotFound( raise vpn_exception.IPsecPolicyNotFound(
ipsecpolicy_id=v_id) ipsecpolicy_id=v_id)
elif issubclass(model, vpn_models.VPNService): if issubclass(model, vpn_models.VPNService):
raise vpn_exception.VPNServiceNotFound(vpnservice_id=v_id) raise vpn_exception.VPNServiceNotFound(vpnservice_id=v_id)
elif issubclass(model, vpn_models.VPNEndpointGroup): if issubclass(model, vpn_models.VPNEndpointGroup):
raise vpn_exception.VPNEndpointGroupNotFound( raise vpn_exception.VPNEndpointGroupNotFound(
endpoint_group_id=v_id) endpoint_group_id=v_id)
ctx.reraise = True ctx.reraise = True

View File

@ -329,8 +329,8 @@ class BaseSwanProcess(object, metaclass=abc.ABCMeta):
# Disable the process if a vpnservice is disabled or it has no # Disable the process if a vpnservice is disabled or it has no
# enabled IPSec site connections. # enabled IPSec site connections.
vpnservice_has_active_ipsec_site_conns = any( vpnservice_has_active_ipsec_site_conns = any(
[ipsec_site_conn['admin_state_up'] ipsec_site_conn['admin_state_up']
for ipsec_site_conn in self.vpnservice['ipsec_site_connections']]) for ipsec_site_conn in self.vpnservice['ipsec_site_connections'])
if (not self.vpnservice['admin_state_up'] or if (not self.vpnservice['admin_state_up'] or
not vpnservice_has_active_ipsec_site_conns): not vpnservice_has_active_ipsec_site_conns):
self.disable() self.disable()

View File

@ -28,7 +28,10 @@ VERSION_TABLE = 'alembic_version_vpnaas'
class _TestModelsMigrationsVPNAAS(test_migrations._TestModelsMigrations): class _TestModelsMigrationsVPNAAS(test_migrations._TestModelsMigrations):
def db_sync(self, engine): def db_sync(self, engine):
cfg.CONF.set_override('connection', engine.url, group='database') cfg.CONF.set_override(
'connection',
engine.url.render_as_string(hide_password=False),
group='database')
for conf in migration.get_alembic_configs(): for conf in migration.get_alembic_configs():
self.alembic_config = conf self.alembic_config = conf
self.alembic_config.neutron_config = cfg.CONF self.alembic_config.neutron_config = cfg.CONF

View File

@ -74,7 +74,7 @@ deps =
{[testenv]deps} {[testenv]deps}
hacking>=4.0.0,<4.1 # Apache-2.0 hacking>=4.0.0,<4.1 # Apache-2.0
flake8-import-order==0.18.1 # LGPLv3 flake8-import-order==0.18.1 # LGPLv3
pylint==2.5.3 # GPLv2 pylint==3.2.0 # GPLv2
isort==4.3.21 # MIT isort==4.3.21 # MIT
commands = commands =
flake8 flake8