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
This commit is contained in:
silvacarloss 2024-03-13 10:59:18 -03:00 committed by Carlos Eduardo
parent d773353502
commit 12aa2913ba
5 changed files with 17 additions and 8 deletions

View File

@ -578,6 +578,10 @@ class ShareBackendException(ManilaException):
message = _("Share backend error: %(msg)s.")
class OperationNotSupportedByDriverMode(ManilaException):
message = _("The share driver mode does not support this operation.")
class RequirementMissing(ManilaException):
message = _("Requirement %(req)s is not installed.")

View File

@ -227,7 +227,7 @@ _vars = {}
def _def_parser():
# 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
Combine = pyparsing.Combine

View File

@ -137,6 +137,7 @@ class API(base.Base):
self.access_helper = access.ShareInstanceAccess(self.db, None)
coordination.LOCK_COORDINATOR.start()
# pylint: disable = no-self-argument
def prevent_locked_action_on_share(arg):
"""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 = (
compatible_azs_multiple)
share = None
try:
share = self.db.share_create(context, options,
create_share_instance=False)
@ -478,7 +480,8 @@ class API(base.Base):
except Exception:
with excutils.save_and_reraise_exception():
try:
self.db.share_delete(context, share['id'])
if share:
self.db.share_delete(context, share['id'])
finally:
QUOTAS.rollback(
context, reservations, share_type_id=share_type_id)
@ -844,6 +847,7 @@ class API(base.Base):
else:
cast_rules_to_readonly = False
share_replica = None
try:
request_spec, share_replica = (
self.create_share_instance_and_get_request_spec(
@ -862,9 +866,10 @@ class API(base.Base):
except Exception:
with excutils.save_and_reraise_exception():
try:
self.db.share_replica_delete(
context, share_replica['id'],
need_to_update_usages=False)
if share_replica:
self.db.share_replica_delete(
context, share_replica['id'],
need_to_update_usages=False)
finally:
QUOTAS.rollback(
context, reservations, share_type_id=share_type['id'])
@ -1639,8 +1644,8 @@ class API(base.Base):
if metadata:
options.update({"metadata": metadata})
snapshot = None
try:
snapshot = None
snapshot = self.db.share_snapshot_create(context, options)
QUOTAS.commit(
context, reservations,

View File

@ -5883,7 +5883,7 @@ class ShareManager(manager.SchedulerDependentManager):
if not self.driver.driver_handles_share_servers:
LOG.error('This operation is supported only on backends that '
'handle share servers.')
raise
raise exception.OperationNotSupportedByDriverMode()
self._share_server_migration_start_driver(
context, share_server, dest_host, writable, nondisruptive,

View File

@ -122,7 +122,7 @@ commands =
[testenv:pylint]
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
pylint==2.3.1
pylint==3.0.2
allowlist_externals = bash
commands = bash ./tools/coding-checks.sh --pylint {posargs}