Many of our functions have to follow a given API, and thus we have to
keep a given signature, but pylint doesn't understand this. Therefore,
we silence this warning.
The patch does a few other cleanups.
---
daemons/ganeti-confd | 6 +++---
daemons/ganeti-masterd | 2 +-
daemons/ganeti-noded | 7 +++++--
daemons/ganeti-rapi | 2 +-
lib/cmdlib.py | 5 +++--
lib/confd/querylib.py | 2 +-
lib/http/__init__.py | 2 ++
lib/http/auth.py | 3 +++
lib/jqueue.py | 1 +
lib/rapi/baserlib.py | 4 +++-
lib/utils.py | 3 ++-
scripts/gnt-backup | 3 ++-
scripts/gnt-cluster | 3 ++-
scripts/gnt-job | 3 ++-
scripts/gnt-node | 3 ++-
scripts/gnt-os | 3 ++-
tools/burnin | 2 ++
tools/cfgshell | 2 ++
18 files changed, 39 insertions(+), 17 deletions(-)
diff --git a/daemons/ganeti-confd b/daemons/ganeti-confd
index 27b11a4..eb91f8b 100755
--- a/daemons/ganeti-confd
+++ b/daemons/ganeti-confd
@@ -325,7 +325,7 @@ class ConfdConfigurationReloader(object):
self._ResetTimer()
-def CheckConfd(options, args):
+def CheckConfd(_, args):
"""Initial checks whether to run exit with a failure.
"""
@@ -340,7 +340,7 @@ def CheckConfd(options, args):
sys.exit(constants.EXIT_FAILURE)
-def ExecConfd(options, args):
+def ExecConfd(options, _):
"""Main confd function, executed with PID file held
"""
@@ -354,7 +354,7 @@ def ExecConfd(options, args):
# If enabling the processor has failed, we can still go on, but confd will
# be disabled
logging.warning("Confd is starting in disabled mode")
- pass
+
server = ConfdAsyncUDPServer(options.bind_address, options.port, processor)
# Configuration reloader
diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd
index 81becca..4d783a8 100755
--- a/daemons/ganeti-masterd
+++ b/daemons/ganeti-masterd
@@ -568,7 +568,7 @@ def CheckMasterd(options, args):
sys.exit(constants.EXIT_FAILURE)
-def ExecMasterd (options, args):
+def ExecMasterd (options, args): # pylint: disable-msg=W0613
"""Main master daemon function, executed with the PID file held.
"""
diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded
index 9aa7187..7a17e4f 100755
--- a/daemons/ganeti-noded
+++ b/daemons/ganeti-noded
@@ -71,12 +71,15 @@ def _RequireJobQueueLock(fn):
return wrapper
-class NodeHttpServer(http.server.HttpServer): # pylint: disable-msg=R0904
+class NodeHttpServer(http.server.HttpServer):
"""The server implementation.
This class holds all methods exposed over the RPC interface.
"""
+ # too many public methods, and unused args - all methods get params
+ # due to the API
+ # pylint: disable-msg=R0904,W0613
def __init__(self, *args, **kwargs):
http.server.HttpServer.__init__(self, *args, **kwargs)
self.noded_pid = os.getpid()
@@ -797,7 +800,7 @@ def CheckNoded(_, args):
sys.exit(constants.EXIT_FAILURE)
-def ExecNoded(options, args):
+def ExecNoded(options, _):
"""Main node daemon function, executed with the PID file held.
"""
diff --git a/daemons/ganeti-rapi b/daemons/ganeti-rapi
index 8fd5265..adbff4c 100755
--- a/daemons/ganeti-rapi
+++ b/daemons/ganeti-rapi
@@ -195,7 +195,7 @@ def CheckRapi(options, args):
ssconf.CheckMaster(options.debug)
-def ExecRapi(options, args):
+def ExecRapi(options, _):
"""Main remote API function, executed with the PID file held.
"""
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 7913dc4..3bb6e1a 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -261,8 +261,6 @@ class LogicalUnit(object):
"""
raise NotImplementedError
- # this is valid in this entire class even if added here
- # pylint: disable-msg=R0201
def HooksCallBack(self, phase, hook_results, feedback_fn, lu_result):
"""Notify the LU about the results of its hooks.
@@ -282,6 +280,9 @@ class LogicalUnit(object):
and hook results
"""
+ # API must be kept, thus we ignore the unused argument and could
+ # be a function warnings
+ # pylint: disable-msg=W0613,R0201
return lu_result
def _ExpandAndLockInstance(self):
diff --git a/lib/confd/querylib.py b/lib/confd/querylib.py
index 7dd474c..e1e323f 100644
--- a/lib/confd/querylib.py
+++ b/lib/confd/querylib.py
@@ -50,7 +50,7 @@ class ConfdQuery(object):
"""
self.reader = reader
- def Exec(self, query): # pylint: disable-msg=R0201
+ def Exec(self, query): # pylint: disable-msg=R0201,W0613
"""Process a single UDP request from a client.
Different queries should override this function, which by defaults returns
diff --git a/lib/http/__init__.py b/lib/http/__init__.py
index d00aba4..6f0d95c 100644
--- a/lib/http/__init__.py
+++ b/lib/http/__init__.py
@@ -640,6 +640,8 @@ class HttpBase(object):
we do on our side.
"""
+ # some parameters are unused, but this is the API
+ # pylint: disable-msg=W0613
assert self._ssl_params, "SSL not initialized"
return (self._ssl_cert.digest("sha1") == cert.digest("sha1") and
diff --git a/lib/http/auth.py b/lib/http/auth.py
index 15fa986..a13c60f 100644
--- a/lib/http/auth.py
+++ b/lib/http/auth.py
@@ -97,6 +97,9 @@ class HttpServerRequestAuthentication(object):
@return: Authentication realm
"""
+ # today we don't have per-request filtering, but we might want to
+ # add it in the future
+ # pylint: disable-msg=W0613
return self.AUTH_REALM
def PreHandleRequest(self, req):
diff --git a/lib/jqueue.py b/lib/jqueue.py
index 6e576b0..2c2345b 100644
--- a/lib/jqueue.py
+++ b/lib/jqueue.py
@@ -923,6 +923,7 @@ class JobQueue(object):
@return: the list of job IDs
"""
+ # pylint: disable-msg=W0613
jlist = [self._ExtractJobID(name) for name in self._ListJobFiles()]
jlist = utils.NiceSort(jlist)
return jlist
diff --git a/lib/rapi/baserlib.py b/lib/rapi/baserlib.py
index 286ec7d..020d7bc 100644
--- a/lib/rapi/baserlib.py
+++ b/lib/rapi/baserlib.py
@@ -201,12 +201,14 @@ def GetClient():
raise http.HttpBadGateway("Master seems to unreachable: %s" % str(err))
-def FeedbackFn(ts, log_type, log_msg):
+def FeedbackFn(ts, log_type, log_msg): # pylint: disable-msg=W0613
"""Feedback logging function for http case.
We don't have a stdout for printing log messages, so log them to the
http log at least.
+ @param ts: the timestamp (unused)
+
"""
logging.info("%s: %s", log_type, log_msg)
diff --git a/lib/utils.py b/lib/utils.py
index c8ac96a..97c28e2 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -2409,7 +2409,8 @@ class SignalHandler(object):
"""
self.called = False
- def _HandleSignal(self, signum, frame):
+ # we don't care about arguments, but we leave them named for the future
+ def _HandleSignal(self, signum, frame): # pylint: disable-msg=W0613
"""Actual signal handling function.
"""
diff --git a/scripts/gnt-backup b/scripts/gnt-backup
index 2890ecb..6593aa5 100755
--- a/scripts/gnt-backup
+++ b/scripts/gnt-backup
@@ -20,8 +20,9 @@
"""Backup related commands"""
-# pylint: disable-msg=W0401,W0614,C0103
+# pylint: disable-msg=W0401,W0613,W0614,C0103
# W0401: Wildcard import ganeti.cli
+# W0613: Unused argument, since all functions follow the same API
# W0614: Unused import %s from wildcard import (since we need cli)
# C0103: Invalid name gnt-backup
diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster
index fc97894..53bea1a 100755
--- a/scripts/gnt-cluster
+++ b/scripts/gnt-cluster
@@ -20,8 +20,9 @@
"""Cluster related commands"""
-# pylint: disable-msg=W0401,W0614,C0103
+# pylint: disable-msg=W0401,W0613,W0614,C0103
# W0401: Wildcard import ganeti.cli
+# W0613: Unused argument, since all functions follow the same API
# W0614: Unused import %s from wildcard import (since we need cli)
# C0103: Invalid name gnt-cluster
diff --git a/scripts/gnt-job b/scripts/gnt-job
index f377478..2e63cf6 100755
--- a/scripts/gnt-job
+++ b/scripts/gnt-job
@@ -20,8 +20,9 @@
"""Job related commands"""
-# pylint: disable-msg=W0401,W0614,C0103
+# pylint: disable-msg=W0401,W0613,W0614,C0103
# W0401: Wildcard import ganeti.cli
+# W0613: Unused argument, since all functions follow the same API
# W0614: Unused import %s from wildcard import (since we need cli)
# C0103: Invalid name gnt-job
diff --git a/scripts/gnt-node b/scripts/gnt-node
index b639b58..f2a13ff 100755
--- a/scripts/gnt-node
+++ b/scripts/gnt-node
@@ -20,8 +20,9 @@
"""Node related commands"""
-# pylint: disable-msg=W0401,W0614,C0103
+# pylint: disable-msg=W0401,W0613,W0614,C0103
# W0401: Wildcard import ganeti.cli
+# W0613: Unused argument, since all functions follow the same API
# W0614: Unused import %s from wildcard import (since we need cli)
# C0103: Invalid name gnt-node
diff --git a/scripts/gnt-os b/scripts/gnt-os
index 40bea55..53304e2 100755
--- a/scripts/gnt-os
+++ b/scripts/gnt-os
@@ -20,8 +20,9 @@
"""OS scripts related commands"""
-# pylint: disable-msg=W0401,W0614,C0103
+# pylint: disable-msg=W0401,W0613,W0614,C0103
# W0401: Wildcard import ganeti.cli
+# W0613: Unused argument, since all functions follow the same API
# W0614: Unused import %s from wildcard import (since we need cli)
# C0103: Invalid name gnt-os
diff --git a/tools/burnin b/tools/burnin
index 8adad91..f0e4113 100755
--- a/tools/burnin
+++ b/tools/burnin
@@ -87,6 +87,8 @@ class SimpleOpener(urllib.FancyURLopener):
def prompt_user_passwd(self, host, realm, clear_cache=0):
"""No-interaction version of prompt_user_passwd."""
+ # we follow parent class' API
+ # pylint: disable-msg=W0613
return None, None
def http_error_default(self, url, fp, errcode, errmsg, headers):
diff --git a/tools/cfgshell b/tools/cfgshell
index 62e501d..57ed0bd 100755
--- a/tools/cfgshell
+++ b/tools/cfgshell
@@ -53,6 +53,8 @@ class ConfigShell(cmd.Cmd):
responsibility to know what they're doing.
"""
+ # all do_/complete_* functions follow the same API
+ # pylint: disable-msg=W0613
prompt = "(/) "
def __init__(self, cfg_file=None):
--
1.6.5.7