Commit 2d54e29c authored by Iustin Pop's avatar Iustin Pop

Further pylint disables, mostly for Unused args

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: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarOlivier Tharan <olive@google.com>
parent 0dda8696
...@@ -325,7 +325,7 @@ class ConfdConfigurationReloader(object): ...@@ -325,7 +325,7 @@ class ConfdConfigurationReloader(object):
self._ResetTimer() self._ResetTimer()
def CheckConfd(options, args): def CheckConfd(_, args):
"""Initial checks whether to run exit with a failure. """Initial checks whether to run exit with a failure.
""" """
...@@ -340,7 +340,7 @@ def CheckConfd(options, args): ...@@ -340,7 +340,7 @@ def CheckConfd(options, args):
sys.exit(constants.EXIT_FAILURE) sys.exit(constants.EXIT_FAILURE)
def ExecConfd(options, args): def ExecConfd(options, _):
"""Main confd function, executed with PID file held """Main confd function, executed with PID file held
""" """
...@@ -354,7 +354,7 @@ def ExecConfd(options, args): ...@@ -354,7 +354,7 @@ def ExecConfd(options, args):
# If enabling the processor has failed, we can still go on, but confd will # If enabling the processor has failed, we can still go on, but confd will
# be disabled # be disabled
logging.warning("Confd is starting in disabled mode") logging.warning("Confd is starting in disabled mode")
pass
server = ConfdAsyncUDPServer(options.bind_address, options.port, processor) server = ConfdAsyncUDPServer(options.bind_address, options.port, processor)
# Configuration reloader # Configuration reloader
......
...@@ -568,7 +568,7 @@ def CheckMasterd(options, args): ...@@ -568,7 +568,7 @@ def CheckMasterd(options, args):
sys.exit(constants.EXIT_FAILURE) 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. """Main master daemon function, executed with the PID file held.
""" """
......
...@@ -71,12 +71,15 @@ def _RequireJobQueueLock(fn): ...@@ -71,12 +71,15 @@ def _RequireJobQueueLock(fn):
return wrapper return wrapper
class NodeHttpServer(http.server.HttpServer): # pylint: disable-msg=R0904 class NodeHttpServer(http.server.HttpServer):
"""The server implementation. """The server implementation.
This class holds all methods exposed over the RPC interface. 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): def __init__(self, *args, **kwargs):
http.server.HttpServer.__init__(self, *args, **kwargs) http.server.HttpServer.__init__(self, *args, **kwargs)
self.noded_pid = os.getpid() self.noded_pid = os.getpid()
...@@ -797,7 +800,7 @@ def CheckNoded(_, args): ...@@ -797,7 +800,7 @@ def CheckNoded(_, args):
sys.exit(constants.EXIT_FAILURE) sys.exit(constants.EXIT_FAILURE)
def ExecNoded(options, args): def ExecNoded(options, _):
"""Main node daemon function, executed with the PID file held. """Main node daemon function, executed with the PID file held.
""" """
......
...@@ -195,7 +195,7 @@ def CheckRapi(options, args): ...@@ -195,7 +195,7 @@ def CheckRapi(options, args):
ssconf.CheckMaster(options.debug) ssconf.CheckMaster(options.debug)
def ExecRapi(options, args): def ExecRapi(options, _):
"""Main remote API function, executed with the PID file held. """Main remote API function, executed with the PID file held.
""" """
......
...@@ -261,8 +261,6 @@ class LogicalUnit(object): ...@@ -261,8 +261,6 @@ class LogicalUnit(object):
""" """
raise NotImplementedError 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): def HooksCallBack(self, phase, hook_results, feedback_fn, lu_result):
"""Notify the LU about the results of its hooks. """Notify the LU about the results of its hooks.
...@@ -282,6 +280,9 @@ class LogicalUnit(object): ...@@ -282,6 +280,9 @@ class LogicalUnit(object):
and hook results 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 return lu_result
def _ExpandAndLockInstance(self): def _ExpandAndLockInstance(self):
......
...@@ -50,7 +50,7 @@ class ConfdQuery(object): ...@@ -50,7 +50,7 @@ class ConfdQuery(object):
""" """
self.reader = reader 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. """Process a single UDP request from a client.
Different queries should override this function, which by defaults returns Different queries should override this function, which by defaults returns
......
...@@ -640,6 +640,8 @@ class HttpBase(object): ...@@ -640,6 +640,8 @@ class HttpBase(object):
we do on our side. 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" assert self._ssl_params, "SSL not initialized"
return (self._ssl_cert.digest("sha1") == cert.digest("sha1") and return (self._ssl_cert.digest("sha1") == cert.digest("sha1") and
......
...@@ -97,6 +97,9 @@ class HttpServerRequestAuthentication(object): ...@@ -97,6 +97,9 @@ class HttpServerRequestAuthentication(object):
@return: Authentication realm @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 return self.AUTH_REALM
def PreHandleRequest(self, req): def PreHandleRequest(self, req):
......
...@@ -923,6 +923,7 @@ class JobQueue(object): ...@@ -923,6 +923,7 @@ class JobQueue(object):
@return: the list of job IDs @return: the list of job IDs
""" """
# pylint: disable-msg=W0613
jlist = [self._ExtractJobID(name) for name in self._ListJobFiles()] jlist = [self._ExtractJobID(name) for name in self._ListJobFiles()]
jlist = utils.NiceSort(jlist) jlist = utils.NiceSort(jlist)
return jlist return jlist
......
...@@ -201,12 +201,14 @@ def GetClient(): ...@@ -201,12 +201,14 @@ def GetClient():
raise http.HttpBadGateway("Master seems to unreachable: %s" % str(err)) 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. """Feedback logging function for http case.
We don't have a stdout for printing log messages, so log them to the We don't have a stdout for printing log messages, so log them to the
http log at least. http log at least.
@param ts: the timestamp (unused)
""" """
logging.info("%s: %s", log_type, log_msg) logging.info("%s: %s", log_type, log_msg)
......
...@@ -2409,7 +2409,8 @@ class SignalHandler(object): ...@@ -2409,7 +2409,8 @@ class SignalHandler(object):
""" """
self.called = False 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. """Actual signal handling function.
""" """
......
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
"""Backup related commands""" """Backup related commands"""
# pylint: disable-msg=W0401,W0614,C0103 # pylint: disable-msg=W0401,W0613,W0614,C0103
# W0401: Wildcard import ganeti.cli # 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) # W0614: Unused import %s from wildcard import (since we need cli)
# C0103: Invalid name gnt-backup # C0103: Invalid name gnt-backup
......
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
"""Cluster related commands""" """Cluster related commands"""
# pylint: disable-msg=W0401,W0614,C0103 # pylint: disable-msg=W0401,W0613,W0614,C0103
# W0401: Wildcard import ganeti.cli # 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) # W0614: Unused import %s from wildcard import (since we need cli)
# C0103: Invalid name gnt-cluster # C0103: Invalid name gnt-cluster
......
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
"""Job related commands""" """Job related commands"""
# pylint: disable-msg=W0401,W0614,C0103 # pylint: disable-msg=W0401,W0613,W0614,C0103
# W0401: Wildcard import ganeti.cli # 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) # W0614: Unused import %s from wildcard import (since we need cli)
# C0103: Invalid name gnt-job # C0103: Invalid name gnt-job
......
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
"""Node related commands""" """Node related commands"""
# pylint: disable-msg=W0401,W0614,C0103 # pylint: disable-msg=W0401,W0613,W0614,C0103
# W0401: Wildcard import ganeti.cli # 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) # W0614: Unused import %s from wildcard import (since we need cli)
# C0103: Invalid name gnt-node # C0103: Invalid name gnt-node
......
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
"""OS scripts related commands""" """OS scripts related commands"""
# pylint: disable-msg=W0401,W0614,C0103 # pylint: disable-msg=W0401,W0613,W0614,C0103
# W0401: Wildcard import ganeti.cli # 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) # W0614: Unused import %s from wildcard import (since we need cli)
# C0103: Invalid name gnt-os # C0103: Invalid name gnt-os
......
...@@ -87,6 +87,8 @@ class SimpleOpener(urllib.FancyURLopener): ...@@ -87,6 +87,8 @@ class SimpleOpener(urllib.FancyURLopener):
def prompt_user_passwd(self, host, realm, clear_cache=0): def prompt_user_passwd(self, host, realm, clear_cache=0):
"""No-interaction version of prompt_user_passwd.""" """No-interaction version of prompt_user_passwd."""
# we follow parent class' API
# pylint: disable-msg=W0613
return None, None return None, None
def http_error_default(self, url, fp, errcode, errmsg, headers): def http_error_default(self, url, fp, errcode, errmsg, headers):
......
...@@ -53,6 +53,8 @@ class ConfigShell(cmd.Cmd): ...@@ -53,6 +53,8 @@ class ConfigShell(cmd.Cmd):
responsibility to know what they're doing. responsibility to know what they're doing.
""" """
# all do_/complete_* functions follow the same API
# pylint: disable-msg=W0613
prompt = "(/) " prompt = "(/) "
def __init__(self, cfg_file=None): def __init__(self, cfg_file=None):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment