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
[MASTER]
[MAIN]
# Add <file or directory> to the black list. It should be a base name, not a
# path. You may set this option multiple times.
#
# Note the 'openstack' below is intended to match only
# neutron.openstack.common. If we ever have another 'openstack'
# dirname, then we'll need to expand the ignore features in pylint :/
ignore=.git,tests,openstack
ignore=.git,tests
# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
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]
# 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
import-error,
# "I" Informational noise
c-extension-no-member,
locally-disabled,
# "E" Error for important programming issues (likely bugs)
access-member-before-definition,
bad-super-call,
maybe-no-member,
no-member,
no-method-argument,
no-self-argument,
not-callable,
no-value-for-parameter,
super-on-old-class,
too-few-format-args,
not-an-iterable,
possibly-used-before-assignment,
# "W" Warnings for stylistic problems or minor programming issues
abstract-method,
anomalous-backslash-in-string,
anomalous-unicode-escape-in-string,
arguments-differ,
attribute-defined-outside-init,
bad-builtin,
bad-indentation,
broad-except,
dangerous-default-value,
deprecated-lambda,
expression-not-assigned,
fixme,
global-statement,
global-variable-not-assigned,
logging-not-lazy,
no-init,
non-parent-init-called,
pointless-string-statement,
not-callable,
protected-access,
redefined-builtin,
redefined-outer-name,
redefine-in-handler,
signature-differs,
star-args,
super-init-not-called,
unnecessary-lambda,
unnecessary-pass,
unpacking-non-sequence,
unreachable,
unused-argument,
unused-import,
unused-variable,
# TODO(dougwig) - disable nonstandard-exception while we have neutron_lib shims
nonstandard-exception,
useless-super-delegation,
unnecessary-pass,
raise-missing-from,
arguments-renamed,
broad-exception-raised,
unspecified-encoding,
redundant-u-string-prefix,
unused-private-member,
# "C" Coding convention violations
bad-continuation,
consider-iterating-dictionary,
consider-using-enumerate,
invalid-name,
len-as-condition,
missing-docstring,
old-style-class,
singleton-comparison,
superfluous-parens,
ungrouped-imports,
wrong-import-order,
consider-using-f-string,
consider-using-dict-items,
# "R" Refactor recommendations
abstract-class-little-used,
abstract-class-not-used,
consider-using-set-comprehension,
consider-merging-isinstance,
consider-using-ternary,
duplicate-code,
inconsistent-return-statements,
interface-not-implemented,
no-else-raise,
no-else-return,
no-self-use,
redefined-argument-from-local,
simplifiable-if-statement,
too-few-public-methods,
too-many-ancestors,
too-many-arguments,
@ -86,10 +84,14 @@ disable=
too-many-instance-attributes,
too-many-lines,
too-many-locals,
too-many-nested-blocks,
too-many-public-methods,
too-many-return-statements,
too-many-statements,
useless-object-inheritance
consider-using-set-comprehension,
useless-object-inheritance,
super-with-arguments,
use-dict-literal
[BASIC]
# 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}$
# 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)$
# Module names matching neutron-* are ok (files in bin/)
@ -119,18 +121,22 @@ max-line-length=79
additional-builtins=_
[CLASSES]
# List of interface methods to ignore, separated by a comma.
ignore-iface-methods=
# List of valid names for the first argument in a class method.
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]
# Deprecated modules which should not be used, separated by a comma
deprecated-modules=
# should use openstack.common.jsonutils
json
# should use oslo_serialization.jsonutils
json,
six
[TYPECHECK]
# List of module names for which member attributes should not be checked
ignored-modules=six.moves,_MovedItems
ignored-modules=_MovedItems
[REPORTS]
# 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(
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)
elif issubclass(model, vpn_models.IPsecPolicy):
if issubclass(model, vpn_models.IPsecPolicy):
raise vpn_exception.IPsecPolicyNotFound(
ipsecpolicy_id=v_id)
elif issubclass(model, vpn_models.VPNService):
if issubclass(model, vpn_models.VPNService):
raise vpn_exception.VPNServiceNotFound(vpnservice_id=v_id)
elif issubclass(model, vpn_models.VPNEndpointGroup):
if issubclass(model, vpn_models.VPNEndpointGroup):
raise vpn_exception.VPNEndpointGroupNotFound(
endpoint_group_id=v_id)
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
# enabled IPSec site connections.
vpnservice_has_active_ipsec_site_conns = any(
[ipsec_site_conn['admin_state_up']
for ipsec_site_conn in self.vpnservice['ipsec_site_connections']])
ipsec_site_conn['admin_state_up']
for ipsec_site_conn in self.vpnservice['ipsec_site_connections'])
if (not self.vpnservice['admin_state_up'] or
not vpnservice_has_active_ipsec_site_conns):
self.disable()

View File

@ -28,7 +28,10 @@ VERSION_TABLE = 'alembic_version_vpnaas'
class _TestModelsMigrationsVPNAAS(test_migrations._TestModelsMigrations):
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():
self.alembic_config = conf
self.alembic_config.neutron_config = cfg.CONF

View File

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