Module: check_mk
Branch: master
Commit: 82b7d735d26033688756047ffd301164ebcf9676
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=82b7d735d26033…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Jul 4 14:50:09 2018 +0200
Fixed and enabled bad-classmethod-argument warnings.
Change-Id: I32c8638fe33bbbc9193a831896e84d924d025965
---
bin/mkbench | 2 +-
omd/packages/omd/omd | 10 ++++------
tests/pylint/pylintrc | 1 -
web/htdocs/backup.py | 2 +-
web/htdocs/metrics.py | 2 +-
web/htdocs/userdb.py | 8 ++++----
web/htdocs/watolib.py | 6 +++---
web/plugins/userdb/htpasswd.py | 6 +++---
web/plugins/userdb/ldap.py | 20 ++++++++++----------
9 files changed, 27 insertions(+), 30 deletions(-)
diff --git a/bin/mkbench b/bin/mkbench
index 1ddf82a..3e3463a 100755
--- a/bin/mkbench
+++ b/bin/mkbench
@@ -990,7 +990,7 @@ DiskIO = namedtuple("DiskIO", ["read_bytes",
"write_bytes"])
class Measurement(object):
@classmethod
- def summary(self, measurements):
+ def summary(cls, measurements):
average_keys = [
"cpu_load",
"disk_io",
diff --git a/omd/packages/omd/omd b/omd/packages/omd/omd
index d5ea454..e98b329 100644
--- a/omd/packages/omd/omd
+++ b/omd/packages/omd/omd
@@ -3950,18 +3950,16 @@ class PackageManager(object):
__metaclass__ = abc.ABCMeta
@classmethod
- def factory(self):
+ def factory(cls):
if os.path.exists("/etc/cma"):
- return
+ return None
distro_code = g_info["DISTRO_CODE"]
if distro_code.startswith("el") \
or distro_code.startswith("sles"):
- cls = PackageManagerRPM
+ return PackageManagerRPM()
else:
- cls = PackageManagerDEB
-
- return cls()
+ return PackageManagerDEB()
@abc.abstractmethod
diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc
index 348ab9d..2157d64 100644
--- a/tests/pylint/pylintrc
+++ b/tests/pylint/pylintrc
@@ -15,7 +15,6 @@ disable=
abstract-method,
arguments-differ,
attribute-defined-outside-init,
- bad-classmethod-argument,
bad-continuation,
bad-indentation,
bad-whitespace,
diff --git a/web/htdocs/backup.py b/web/htdocs/backup.py
index f8adad4..2018eef 100644
--- a/web/htdocs/backup.py
+++ b/web/htdocs/backup.py
@@ -206,7 +206,7 @@ class BackupEntityCollection(object):
# Abstract class for backup jobs (Job) and restore job (RestoreJob)
class MKBackupJob(object):
@classmethod
- def state_name(self, state):
+ def state_name(cls, state):
return {
"started" : _("Started"),
"running" : _("Currently running"),
diff --git a/web/htdocs/metrics.py b/web/htdocs/metrics.py
index 3eb2c43..bda797a 100644
--- a/web/htdocs/metrics.py
+++ b/web/htdocs/metrics.py
@@ -283,7 +283,7 @@ class GraphDestinations(object):
notification = "notification"
@classmethod
- def choices(self):
+ def choices(cls):
return [
(GraphDestinations.dashlet, _("Dashlet")),
(GraphDestinations.view, _("View")),
diff --git a/web/htdocs/userdb.py b/web/htdocs/userdb.py
index a22ed97..8d4346f 100644
--- a/web/htdocs/userdb.py
+++ b/web/htdocs/userdb.py
@@ -1121,17 +1121,17 @@ class UserConnector(object):
self._config = config
@classmethod
- def type(self):
+ def type(cls):
return None
# The string representing this connector to humans
@classmethod
- def title(self):
+ def title(cls):
return None
@classmethod
- def short_title(self):
+ def short_title(cls):
return _('htpasswd')
#
@@ -1139,7 +1139,7 @@ class UserConnector(object):
#
@classmethod
- def migrate_config(self):
+ def migrate_config(cls):
pass
# Optional: Hook function can be registered here to be executed
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index a629ef9..22e7ad6 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -315,7 +315,7 @@ class ConfigDomain(object):
@classmethod
- def enabled(self):
+ def enabled(cls):
return True
@@ -438,7 +438,7 @@ class ConfigDomainEventConsole(ConfigDomain):
@classmethod
- def enabled(self):
+ def enabled(cls):
return config.mkeventd_enabled
@@ -9651,7 +9651,7 @@ class ACTestCategories(object):
@classmethod
- def title(self, ident):
+ def title(cls, ident):
return {
"usability" : _("Usability"),
"performance" : _("Performance"),
diff --git a/web/plugins/userdb/htpasswd.py b/web/plugins/userdb/htpasswd.py
index 71ebfea..ab2f0e4 100644
--- a/web/plugins/userdb/htpasswd.py
+++ b/web/plugins/userdb/htpasswd.py
@@ -40,17 +40,17 @@ class HtpasswdUserConnector(UserConnector):
@classmethod
- def type(self):
+ def type(cls):
return 'htpasswd'
@classmethod
- def title(self):
+ def title(cls):
return _('Apache Local Password File (htpasswd)')
@classmethod
- def short_title(self):
+ def short_title(cls):
return _('htpasswd')
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index cb03e87..f063f50 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -185,23 +185,23 @@ class LDAPUserConnector(UserConnector):
@classmethod
- def type(self):
+ def type(cls):
return 'ldap'
@classmethod
- def title(self):
+ def title(cls):
return _('LDAP (Active Directory, OpenLDAP)')
@classmethod
- def short_title(self):
+ def short_title(cls):
return _('LDAP')
@classmethod
- def get_connection_suffixes(self):
- return self.connection_suffixes
+ def get_connection_suffixes(cls):
+ return cls.connection_suffixes
def id(self):
@@ -865,17 +865,17 @@ class LDAPUserConnector(UserConnector):
# This function migrates the former configuration to the new one.
# TODO This code can be removed the day we decide not to migrate old configs
anymore.
@classmethod
- def migrate_config(self):
+ def migrate_config(cls):
if config.user_connections:
return # Don't try to migrate anything when there is at least one
connection configured
- if self.needs_config_migration():
- self.do_migrate_config()
+ if cls.needs_config_migration():
+ cls.do_migrate_config()
# Don't migrate anything when no ldap connection has been configured
@classmethod
- def needs_config_migration(self):
+ def needs_config_migration(cls):
ldap_connection = getattr(config, 'ldap_connection', {})
default_ldap_connection_config = {
'type' : 'ad',
@@ -885,7 +885,7 @@ class LDAPUserConnector(UserConnector):
@classmethod
- def do_migrate_config(self):
+ def do_migrate_config(cls):
# Create a default connection out of the old config format
connection = {
'id' : 'default',