* Update pylint to 2.6.0.
* Fix pylint issues.
Fixes: https://tracker.ceph.com/issues/47647
Signed-off-by: Volker Theile <vtheile@suse.com>
s
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
-#init-hook=
+init-hook='import sys; sys.path.append("./")'
# Use multiple processes to speed up Pylint.
jobs=1
too-many-arguments,
too-many-locals,
too-many-statements,
- useless-object-inheritance
+ useless-object-inheritance,
+ relative-beyond-top-level,
+ raise-missing-from,
+ super-with-arguments,
+ import-outside-toplevel
# Enable the message, report, category or checker with the given id(s). You can
@Endpoint('GET', '/cephx/clients')
@ReadPermission
def cephx_clients(self):
- return [client for client in CephX.list_clients()]
+ return list(CephX.list_clients())
@Endpoint('GET', '/fsals')
@ReadPermission
@CreatePermission
@osd_task('create', {'tracking_id': '{tracking_id}'})
- def create(self, method, data, tracking_id): # pylint: disable=W0622
+ def create(self, method, data, tracking_id): # pylint: disable=unused-argument
if method == 'bare':
return self._create_bare(data)
if method == 'drive_groups':
PLUGIN_MANAGER = DashboardPluginManager("ceph-mgr.dashboard")
# Load all interfaces and their hooks
-from . import interfaces # noqa: F401 pylint: disable=wrong-import-position,cyclic-import
+from . import interfaces # noqa pylint: disable=C0413,W0406
-pylint==2.3.1; python_version >= '3'
+pylint==2.6.0
flake8==3.7.8; python_version >= '3'
flake8-colors==0.1.6; python_version >= '3'
#TODO: Fix docstring issues: https://tracker.ceph.com/issues/41224
def _check_authorization(self, username):
self.logger.debug("checking authorization...")
- username = username
handler = cherrypy.request.handler.callable
controller = handler.__self__
sec_scope = getattr(controller, '_security_scope', None)
from ..exceptions import DashboardException
try:
- from typing import Dict, Any, Union # pylint: disable=unused-import
+ from typing import Dict, Any, Union
except ImportError:
pass # For typing only
@classmethod
def list_clients(cls):
- return [client for client in cls._clients_map()]
+ return list(cls._clients_map())
@classmethod
def get_client_key(cls, client_id):
@classmethod
def get_ganesha_clusters(cls):
- return [cluster_id for cluster_id in cls._get_clusters_locations()]
+ return list(cls._get_clusters_locations())
@staticmethod
def _get_orch_nfs_instances():
for key, val in block.items():
if key == 'block_name':
continue
- elif key == '_blocks_':
+ if key == '_blocks_':
for blo in val:
conf_str += GaneshaConfParser.write_block(blo, depth)
elif val:
result['attr_expiration_time'] = self.attr_expiration_time
result['security_label'] = self.security_label
if 'protocols' not in defaults:
- result['protocols'] = [p for p in self.protocols]
+ result['protocols'] = list(self.protocols)
else:
def_proto = defaults['protocols']
if not isinstance(def_proto, list):
def_proto = set([def_proto])
if self.protocols != def_proto:
- result['protocols'] = [p for p in self.protocols]
+ result['protocols'] = list(self.protocols)
if 'transports' not in defaults:
- result['transports'] = [t for t in self.transports]
+ result['transports'] = list(self.transports)
else:
def_transp = defaults['transports']
if not isinstance(def_transp, list):
def_transp = set([def_transp])
if self.transports != def_transp:
- result['transports'] = [t for t in self.transports]
+ result['transports'] = list(self.transports)
result['_blocks_'] = [self.fsal.to_fsal_block()]
result['_blocks_'].extend([client.to_client_block()
'path': self.path,
'fsal': self.fsal.to_dict(),
'cluster_id': self.cluster_id,
- 'daemons': sorted([d for d in self.daemons]),
+ 'daemons': sorted(list(self.daemons)),
'pseudo': self.pseudo,
'tag': self.tag,
'access_type': self.access_type,
'squash': self.squash,
'security_label': self.security_label,
- 'protocols': sorted([p for p in self.protocols]),
- 'transports': sorted([t for t in self.transports]),
+ 'protocols': sorted(list(self.protocols)),
+ 'transports': sorted(list(self.transports)),
'clients': [client.to_dict() for client in self.clients]
}
return None
def list_daemons(self):
- return [daemon_id for daemon_id in self.daemons_conf_blocks]
+ return list(self.daemons_conf_blocks)
def reload_daemons(self, daemons):
with mgr.rados.open_ioctx(self.rados_pool) as ioctx:
except ImportError:
from urllib.parse import urlparse
-from .iscsi_config import IscsiGatewaysConfig # pylint: disable=cyclic-import
+from .iscsi_config import IscsiGatewaysConfig
from ..settings import Settings
from ..rest_client import RestClient
"""
for gateway_name, gateway_config in config['gateways'].items():
if '.' not in gateway_name:
- from .iscsi_client import IscsiClient
+ from .iscsi_client import IscsiClient # pylint: disable=cyclic-import
from ..rest_client import RequestException
try:
service_url = gateway_config['service_url']
from datetime import datetime
import logging
-from . import rbd
+from . import rbd # pylint: disable=no-name-in-module
from .. import mgr
from .. import mgr
try:
- from typing import Dict, List, Optional # pylint: disable=unused-import
+ from typing import Dict, List, Optional
except ImportError:
pass # For typing only
if self.userid != RgwClient._SYSTEM_USERID:
logger.info("Fetching new keys for user: %s", self.userid)
keys = RgwClient.admin_instance().get_user_keys(self.userid)
+ # pylint: disable=attribute-defined-outside-init
self.auth = S3Auth(keys['access_key'], keys['secret_key'],
service_url=self.service_url)
else:
from ..services.exception import dashboard_exception_handler
from ..plugins import PLUGIN_MANAGER
-from ..plugins import feature_toggles, debug # noqa # pylint: disable=unused-import
+from ..plugins import feature_toggles, debug # noqa
PLUGIN_MANAGER.hook.init()
from __future__ import absolute_import
try:
- from typing import Dict, Any # pylint: disable=unused-import
+ from typing import Dict, Any
except ImportError:
pass
from datetime import datetime, timedelta
-from . import CmdException, CLICommandTestMixin
+from . import CmdException, CLICommandTestMixin # pylint: disable=no-name-in-module
from .. import mgr
from ..security import Scope, Permission
from ..services.access_control import load_access_control_db, \
except ImportError:
import unittest.mock as mock
-from . import ControllerTestCase, KVStoreMockMixin
+from . import ControllerTestCase, KVStoreMockMixin # pylint: disable=no-name-in-module
from ..controllers import RESTController, Controller
from ..tools import RequestLoggingTool
from .. import mgr
from unittest.mock import Mock
from .. import mgr
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from ..controllers.cephfs import CephFS
# -*- coding: utf-8 -*-
from __future__ import absolute_import
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from ..controllers import BaseController, RESTController, Controller, \
ApiController, Endpoint
# # -*- coding: utf-8 -*-
from __future__ import absolute_import
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from ..controllers import RESTController, ApiController, Endpoint, EndpointDoc, ControllerDoc
from ..controllers.docs import Docs
# -*- coding: utf-8 -*-
from .. import mgr
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from ..controllers.erasure_code_profile import ErasureCodeProfile
import rados
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from ..services.ceph_service import SendCommandError
from ..controllers import RESTController, Controller, Task, Endpoint
from ..services.exception import handle_rados_error, handle_send_command_error, \
except ImportError:
from unittest.mock import Mock, patch
-from . import KVStoreMockMixin
+from . import KVStoreMockMixin # pylint: disable=no-name-in-module
from ..plugins.feature_toggles import FeatureToggles, Features
from unittest.mock import MagicMock, Mock
import orchestrator
-from . import KVStoreMockMixin
+from . import KVStoreMockMixin # pylint: disable=no-name-in-module
from .. import mgr
from ..settings import Settings
from ..services import ganesha
from requests import RequestException
-from . import ControllerTestCase, KVStoreMockMixin
+from . import ControllerTestCase, KVStoreMockMixin # pylint: disable=no-name-in-module
from ..controllers.grafana import Grafana
from ..grafana import GrafanaRestClient
from ..settings import Settings
except ImportError:
import unittest.mock as mock
-from . import ControllerTestCase, FakeFsMixin
+from . import ControllerTestCase, FakeFsMixin # pylint: disable=no-name-in-module
from .. import mgr
from ..controllers.home import HomeController, LanguageMixin
from orchestrator import HostSpec
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from ..controllers.host import get_hosts, Host, HostUi
from .. import mgr
except ImportError:
import unittest.mock as mock
-from . import CmdException, ControllerTestCase, CLICommandTestMixin, KVStoreMockMixin
+from . import CmdException, ControllerTestCase, CLICommandTestMixin, \
+ KVStoreMockMixin # pylint: disable=no-name-in-module
from .. import mgr
from ..controllers.iscsi import Iscsi, IscsiTarget
from ..services.iscsi_client import IscsiClient
from orchestrator import InventoryHost
from orchestrator import Orchestrator as OrchestratorBase
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from .. import mgr
from ..controllers.orchestrator import get_device_osd_map
from ..controllers.orchestrator import Orchestrator
from ceph.deployment.drive_group import DeviceSelection, DriveGroupSpec # type: ignore
from ceph.deployment.service_spec import PlacementSpec # type: ignore
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from ..controllers.osd import Osd
from ..tools import NotificationQueue, TaskManager
from .. import mgr
-from .helper import update_dict
+from .helper import update_dict # pylint: disable=import-error
from typing import Any, Dict, List, Optional # pylint: disable=C0411
# -*- coding: utf-8 -*-
from __future__ import absolute_import
-from . import CLICommandTestMixin, ControllerTestCase
+from . import CLICommandTestMixin, ControllerTestCase # pylint: disable=no-name-in-module
class TestPluginDebug(ControllerTestCase, CLICommandTestMixin):
except ImportError:
import unittest.mock as mock
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from ..controllers.pool import Pool
from ..controllers.task import Task
from ..tools import NotificationQueue, TaskManager
except ImportError:
from unittest.mock import patch
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from .. import mgr
from ..controllers.prometheus import Prometheus, PrometheusReceiver, PrometheusNotifications
except ImportError:
import unittest.mock as mock
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from .. import mgr
from ..controllers.summary import Summary
from ..controllers.rbd_mirroring import RbdMirroring, RbdMirroringSummary, \
except ImportError:
import unittest.mock as mock
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from ..controllers import Controller, RESTController, Task
from ..controllers.task import Task as TaskController
from ..services import progress
except ImportError:
import unittest.mock as mock
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from ..controllers.rgw import RgwUser
from ..services.rgw_client import RgwClient, _parse_frontend_config
from ..settings import Settings
-from . import KVStoreMockMixin
+from . import KVStoreMockMixin # pylint: disable=no-name-in-module
class RgwClientTest(unittest.TestCase, KVStoreMockMixin):
import errno
import unittest
-from . import KVStoreMockMixin, ControllerTestCase
+from . import KVStoreMockMixin, ControllerTestCase # pylint: disable=no-name-in-module
from .. import settings
from ..controllers.settings import Settings as SettingsController
from ..settings import Settings, handle_option_command
import errno
import unittest
-from . import CmdException, exec_dashboard_cmd, KVStoreMockMixin
+from . import CmdException, exec_dashboard_cmd, \
+ KVStoreMockMixin # pylint: disable=no-name-in-module
from ..services.sso import handle_sso_command, load_sso_db
except ImportError:
from unittest.mock import patch
-from . import ControllerTestCase
+from . import ControllerTestCase # pylint: disable=no-name-in-module
from ..services.exception import handle_rados_error
from ..controllers import RESTController, ApiController, Controller, \
BaseController, Proxy
try:
from typing import Any, AnyStr, Callable, DefaultDict, Deque,\
- Dict, List, Set, Tuple, Union # noqa pylint: disable=unused-import
+ Dict, List, Set, Tuple, Union # noqa
except ImportError:
pass # For typing only