Bump pylint version and fix pylint issues
Bumps pylint to version 3.0.2 and fixes some issues in the code
by either ignoring or changing the way we are approaching them.
Signed-off-by: silvacarloss <ces.eduardo98@gmail.com>
Change-Id: Ifdc9ae9326f2b3d63d4b2e9ce14854f391d504a9
(cherry picked from commit 12aa2913ba
)
This commit is contained in:
parent
44df1ec42d
commit
ad8e5a1d50
@ -574,6 +574,10 @@ class ShareBackendException(ManilaException):
|
|||||||
message = _("Share backend error: %(msg)s.")
|
message = _("Share backend error: %(msg)s.")
|
||||||
|
|
||||||
|
|
||||||
|
class OperationNotSupportedByDriverMode(ManilaException):
|
||||||
|
message = _("The share driver mode does not support this operation.")
|
||||||
|
|
||||||
|
|
||||||
class RequirementMissing(ManilaException):
|
class RequirementMissing(ManilaException):
|
||||||
message = _("Requirement %(req)s is not installed.")
|
message = _("Requirement %(req)s is not installed.")
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ _vars = {}
|
|||||||
|
|
||||||
def _def_parser():
|
def _def_parser():
|
||||||
# Enabling packrat parsing greatly speeds up the parsing.
|
# Enabling packrat parsing greatly speeds up the parsing.
|
||||||
pyparsing.ParserElement.enablePackrat()
|
pyparsing.ParserElement.enablePackrat() # pylint: disable = no-value-for-parameter # noqa:E501
|
||||||
|
|
||||||
alphas = pyparsing.alphas
|
alphas = pyparsing.alphas
|
||||||
Combine = pyparsing.Combine
|
Combine = pyparsing.Combine
|
||||||
|
@ -137,6 +137,7 @@ class API(base.Base):
|
|||||||
self.access_helper = access.ShareInstanceAccess(self.db, None)
|
self.access_helper = access.ShareInstanceAccess(self.db, None)
|
||||||
coordination.LOCK_COORDINATOR.start()
|
coordination.LOCK_COORDINATOR.start()
|
||||||
|
|
||||||
|
# pylint: disable = no-self-argument
|
||||||
def prevent_locked_action_on_share(arg):
|
def prevent_locked_action_on_share(arg):
|
||||||
"""Decorator for preventing a locked method from executing on a share.
|
"""Decorator for preventing a locked method from executing on a share.
|
||||||
|
|
||||||
@ -471,6 +472,7 @@ class API(base.Base):
|
|||||||
az_request_multiple_subnet_support_map = (
|
az_request_multiple_subnet_support_map = (
|
||||||
compatible_azs_multiple)
|
compatible_azs_multiple)
|
||||||
|
|
||||||
|
share = None
|
||||||
try:
|
try:
|
||||||
share = self.db.share_create(context, options,
|
share = self.db.share_create(context, options,
|
||||||
create_share_instance=False)
|
create_share_instance=False)
|
||||||
@ -478,6 +480,7 @@ class API(base.Base):
|
|||||||
except Exception:
|
except Exception:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
try:
|
try:
|
||||||
|
if share:
|
||||||
self.db.share_delete(context, share['id'])
|
self.db.share_delete(context, share['id'])
|
||||||
finally:
|
finally:
|
||||||
QUOTAS.rollback(
|
QUOTAS.rollback(
|
||||||
@ -844,6 +847,7 @@ class API(base.Base):
|
|||||||
else:
|
else:
|
||||||
cast_rules_to_readonly = False
|
cast_rules_to_readonly = False
|
||||||
|
|
||||||
|
share_replica = None
|
||||||
try:
|
try:
|
||||||
request_spec, share_replica = (
|
request_spec, share_replica = (
|
||||||
self.create_share_instance_and_get_request_spec(
|
self.create_share_instance_and_get_request_spec(
|
||||||
@ -862,6 +866,7 @@ class API(base.Base):
|
|||||||
except Exception:
|
except Exception:
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
try:
|
try:
|
||||||
|
if share_replica:
|
||||||
self.db.share_replica_delete(
|
self.db.share_replica_delete(
|
||||||
context, share_replica['id'],
|
context, share_replica['id'],
|
||||||
need_to_update_usages=False)
|
need_to_update_usages=False)
|
||||||
@ -1639,8 +1644,8 @@ class API(base.Base):
|
|||||||
if metadata:
|
if metadata:
|
||||||
options.update({"metadata": metadata})
|
options.update({"metadata": metadata})
|
||||||
|
|
||||||
try:
|
|
||||||
snapshot = None
|
snapshot = None
|
||||||
|
try:
|
||||||
snapshot = self.db.share_snapshot_create(context, options)
|
snapshot = self.db.share_snapshot_create(context, options)
|
||||||
QUOTAS.commit(
|
QUOTAS.commit(
|
||||||
context, reservations,
|
context, reservations,
|
||||||
|
@ -5876,7 +5876,7 @@ class ShareManager(manager.SchedulerDependentManager):
|
|||||||
if not self.driver.driver_handles_share_servers:
|
if not self.driver.driver_handles_share_servers:
|
||||||
LOG.error('This operation is supported only on backends that '
|
LOG.error('This operation is supported only on backends that '
|
||||||
'handle share servers.')
|
'handle share servers.')
|
||||||
raise
|
raise exception.OperationNotSupportedByDriverMode()
|
||||||
|
|
||||||
self._share_server_migration_start_driver(
|
self._share_server_migration_start_driver(
|
||||||
context, share_server, dest_host, writable, nondisruptive,
|
context, share_server, dest_host, writable, nondisruptive,
|
||||||
|
2
tox.ini
2
tox.ini
@ -115,7 +115,7 @@ commands =
|
|||||||
[testenv:pylint]
|
[testenv:pylint]
|
||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
pylint==2.3.1
|
pylint==3.0.2
|
||||||
allowlist_externals = bash
|
allowlist_externals = bash
|
||||||
commands = bash ./tools/coding-checks.sh --pylint {posargs}
|
commands = bash ./tools/coding-checks.sh --pylint {posargs}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user