Further pylint disables, mostly for Unused args
authorIustin Pop <iustin@google.com>
Tue, 29 Dec 2009 16:53:57 +0000 (17:53 +0100)
committerIustin Pop <iustin@google.com>
Mon, 4 Jan 2010 09:17:12 +0000 (10:17 +0100)
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.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Olivier Tharan <olive@google.com>

18 files changed:
daemons/ganeti-confd
daemons/ganeti-masterd
daemons/ganeti-noded
daemons/ganeti-rapi
lib/cmdlib.py
lib/confd/querylib.py
lib/http/__init__.py
lib/http/auth.py
lib/jqueue.py
lib/rapi/baserlib.py
lib/utils.py
scripts/gnt-backup
scripts/gnt-cluster
scripts/gnt-job
scripts/gnt-node
scripts/gnt-os
tools/burnin
tools/cfgshell

index 27b11a4..eb91f8b 100755 (executable)
@@ -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
index 81becca..4d783a8 100755 (executable)
@@ -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.
 
   """
index 9aa7187..7a17e4f 100755 (executable)
@@ -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.
 
   """
index 8fd5265..adbff4c 100755 (executable)
@@ -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.
 
   """
index 7913dc4..3bb6e1a 100644 (file)
@@ -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):
index 7dd474c..e1e323f 100644 (file)
@@ -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
index d00aba4..6f0d95c 100644 (file)
@@ -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
index 15fa986..a13c60f 100644 (file)
@@ -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):
index 6e576b0..2c2345b 100644 (file)
@@ -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
index 286ec7d..020d7bc 100644 (file)
@@ -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)
 
index c8ac96a..97c28e2 100644 (file)
@@ -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.
 
     """
index 2890ecb..6593aa5 100755 (executable)
@@ -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
 
index fc97894..53bea1a 100755 (executable)
@@ -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
 
index f377478..2e63cf6 100755 (executable)
@@ -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
 
index b639b58..f2a13ff 100755 (executable)
@@ -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
 
index 40bea55..53304e2 100755 (executable)
@@ -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
 
index 8adad91..f0e4113 100755 (executable)
@@ -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):
index 62e501d..57ed0bd 100755 (executable)
@@ -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):