From b459a848dc62e314e61e8ae14edd3ff6cc2b2822 Mon Sep 17 00:00:00 2001 From: Andrea Spadaccini <spadaccio@google.com> Date: Mon, 29 Aug 2011 20:15:15 +0100 Subject: [PATCH] DeprecationWarning fixes for pylint In version 0.21, pylint unified all the disable-* (and enable-*) directives to disable (resp. enable). This leads to a lot of DeprecationWarning being emitted even if one uses the recommended version of pylint (0.21.1, as stated in devnotes.rst). This commit changes all the disable-msg directives to disable. Signed-off-by: Andrea Spadaccini <spadaccio@google.com> Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- autotools/build-bash-completion | 4 +- daemons/import-export | 6 +-- lib/asyncnotifier.py | 10 ++-- lib/backend.py | 14 +++--- lib/bdev.py | 4 +- lib/bootstrap.py | 2 +- lib/build/sphinx_ext.py | 6 +-- lib/cli.py | 16 +++---- lib/client/gnt_backup.py | 2 +- lib/client/gnt_cluster.py | 10 ++-- lib/client/gnt_debug.py | 6 +-- lib/client/gnt_group.py | 2 +- lib/client/gnt_instance.py | 8 ++-- lib/client/gnt_job.py | 2 +- lib/client/gnt_node.py | 2 +- lib/client/gnt_os.py | 2 +- lib/cmdlib.py | 82 ++++++++++++++++----------------- lib/compat.py | 22 ++++----- lib/confd/client.py | 4 +- lib/confd/querylib.py | 2 +- lib/config.py | 4 +- lib/daemon.py | 4 +- lib/http/__init__.py | 4 +- lib/http/auth.py | 4 +- lib/http/server.py | 4 +- lib/hypervisor/hv_base.py | 2 +- lib/hypervisor/hv_chroot.py | 4 +- lib/hypervisor/hv_lxc.py | 2 +- lib/jqueue.py | 14 +++--- lib/locking.py | 10 ++-- lib/luxi.py | 10 ++-- lib/mcpu.py | 2 +- lib/objects.py | 8 ++-- lib/opcodes.py | 6 +-- lib/qlang.py | 2 +- lib/query.py | 12 ++--- lib/rapi/baserlib.py | 4 +- lib/rapi/client.py | 2 +- lib/rapi/connector.py | 2 +- lib/rapi/rlib2.py | 10 ++-- lib/rpc.py | 6 +-- lib/runtime.py | 4 +- lib/serializer.py | 4 +- lib/server/confd.py | 8 ++-- lib/server/masterd.py | 12 ++--- lib/server/noded.py | 10 ++-- lib/server/rapi.py | 14 +++--- lib/storage.py | 12 ++--- lib/utils/__init__.py | 4 +- lib/utils/log.py | 14 +++--- lib/utils/mlock.py | 6 +-- lib/utils/process.py | 20 ++++---- lib/utils/retry.py | 6 +-- lib/utils/text.py | 2 +- lib/utils/wrapper.py | 2 +- lib/watcher/__init__.py | 20 ++++---- lib/watcher/nodemaint.py | 6 +-- lib/watcher/state.py | 2 +- lib/workerpool.py | 8 ++-- qa/ganeti-qa.py | 4 +- qa/qa_config.py | 2 +- qa/qa_instance.py | 4 +- qa/qa_rapi.py | 6 +-- qa/qa_utils.py | 2 +- tools/burnin | 18 ++++---- tools/cfgshell | 12 ++--- tools/cfgupgrade | 2 +- tools/cfgupgrade12 | 4 +- tools/check-cert-expired | 4 +- tools/cluster-merge | 20 ++++---- tools/ganeti-listrunner | 4 +- tools/lvmstrap | 2 +- tools/move-instance | 8 ++-- tools/sanitize-config | 10 ++-- tools/setup-ssh | 2 +- 75 files changed, 290 insertions(+), 290 deletions(-) diff --git a/autotools/build-bash-completion b/autotools/build-bash-completion index 8af38af63..ec9c0a6c6 100755 --- a/autotools/build-bash-completion +++ b/autotools/build-bash-completion @@ -23,7 +23,7 @@ """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # [C0103] Invalid name build-bash-completion import os @@ -241,7 +241,7 @@ class CompletionWriter: for opt in opts: # While documented, these variables aren't seen as public attributes by - # pylint. pylint: disable-msg=W0212 + # pylint. pylint: disable=W0212 opt.all_names = sorted(opt._short_opts + opt._long_opts) def _FindFirstArgument(self, sw): diff --git a/daemons/import-export b/daemons/import-export index a63e4c24c..86034608d 100755 --- a/daemons/import-export +++ b/daemons/import-export @@ -23,7 +23,7 @@ """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # C0103: Invalid name import-export import errno @@ -353,7 +353,7 @@ def ParseOptions(): @return: Arguments to program """ - global options # pylint: disable-msg=W0603 + global options # pylint: disable=W0603 parser = optparse.OptionParser(usage=("%%prog <status-file> {%s|%s}" % (constants.IEM_IMPORT, @@ -587,7 +587,7 @@ def main(): errmsg = "Exited with status %s" % (child.returncode, ) status_file.SetExitStatus(child.returncode, errmsg) - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 logging.exception("Unhandled error occurred") status_file.SetExitStatus(constants.EXIT_FAILURE, "Unhandled error occurred: %s" % (err, )) diff --git a/lib/asyncnotifier.py b/lib/asyncnotifier.py index 6f74542a9..37a2fcbd8 100644 --- a/lib/asyncnotifier.py +++ b/lib/asyncnotifier.py @@ -26,7 +26,7 @@ import asyncore import logging try: - # pylint: disable-msg=E0611 + # pylint: disable=E0611 from pyinotify import pyinotify except ImportError: import pyinotify @@ -42,7 +42,7 @@ class AsyncNotifier(asyncore.file_dispatcher): """An asyncore dispatcher for inotify events. """ - # pylint: disable-msg=W0622,W0212 + # pylint: disable=W0622,W0212 def __init__(self, watch_manager, default_proc_fun=None, map=None): """Initializes this class. @@ -90,7 +90,7 @@ class FileEventHandlerBase(pyinotify.ProcessEvent): @param watch_manager: inotify watch manager """ - # pylint: disable-msg=W0231 + # pylint: disable=W0231 # no need to call the parent's constructor self.watch_manager = watch_manager @@ -168,7 +168,7 @@ class SingleFileEventHandler(FileEventHandlerBase): if self._watch_handle is not None and self.RemoveWatch(self._watch_handle): self._watch_handle = None - # pylint: disable-msg=C0103 + # pylint: disable=C0103 # this overrides a method in pyinotify.ProcessEvent def process_IN_IGNORED(self, event): # Since we monitor a single file rather than the directory it resides in, @@ -182,7 +182,7 @@ class SingleFileEventHandler(FileEventHandlerBase): self._watch_handle = None self._callback(False) - # pylint: disable-msg=C0103 + # pylint: disable=C0103 # this overrides a method in pyinotify.ProcessEvent def process_IN_MODIFY(self, event): # This gets called when the monitored file is modified. Note that this diff --git a/lib/backend.py b/lib/backend.py index 84a39d07d..d02a88841 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -28,7 +28,7 @@ """ -# pylint: disable-msg=E1103 +# pylint: disable=E1103 # E1103: %s %r has no %r member (but some types could not be # inferred), because the _TryOSFromDisk returns either (True, os_obj) @@ -412,7 +412,7 @@ def LeaveCluster(modify_ssh_setup): utils.RemoveFile(constants.CONFD_HMAC_KEY) utils.RemoveFile(constants.RAPI_CERT_FILE) utils.RemoveFile(constants.NODED_CERT_FILE) - except: # pylint: disable-msg=W0702 + except: # pylint: disable=W0702 logging.exception("Error while removing cluster secrets") result = utils.RunCmd([constants.DAEMON_UTIL, "stop", constants.CONFD]) @@ -1340,7 +1340,7 @@ def BlockdevCreate(disk, size, owner, on_primary, info): """ # TODO: remove the obsolete "size" argument - # pylint: disable-msg=W0613 + # pylint: disable=W0613 clist = [] if disk.children: for child in disk.children: @@ -1352,7 +1352,7 @@ def BlockdevCreate(disk, size, owner, on_primary, info): # we need the children open in case the device itself has to # be assembled try: - # pylint: disable-msg=E1103 + # pylint: disable=E1103 crdev.Open() except errors.BlockDeviceError, err: _Fail("Can't make child '%s' read-write: %s", child, err) @@ -1568,7 +1568,7 @@ def BlockdevAssemble(disk, owner, as_primary, idx): try: result = _RecursiveAssembleBD(disk, owner, as_primary) if isinstance(result, bdev.BlockDev): - # pylint: disable-msg=E1103 + # pylint: disable=E1103 result = result.dev_path if as_primary: _SymlinkBlockDev(owner, result, idx) @@ -3322,7 +3322,7 @@ def PowercycleNode(hypervisor_type): # ensure the child is running on ram try: utils.Mlockall() - except Exception: # pylint: disable-msg=W0703 + except Exception: # pylint: disable=W0703 pass time.sleep(5) hyper.PowercycleNode() @@ -3347,7 +3347,7 @@ class HooksRunner(object): hooks_base_dir = constants.HOOKS_BASE_DIR # yeah, _BASE_DIR is not valid for attributes, we use it like a # constant - self._BASE_DIR = hooks_base_dir # pylint: disable-msg=C0103 + self._BASE_DIR = hooks_base_dir # pylint: disable=C0103 def RunHooks(self, hpath, phase, env): """Run the scripts in the hooks directory. diff --git a/lib/bdev.py b/lib/bdev.py index 604a5b411..d8603df8d 100644 --- a/lib/bdev.py +++ b/lib/bdev.py @@ -889,7 +889,7 @@ class DRBD8Status(object): self.est_time = None -class BaseDRBD(BlockDev): # pylint: disable-msg=W0223 +class BaseDRBD(BlockDev): # pylint: disable=W0223 """Base DRBD class. This class contains a few bits of common functionality between the @@ -1765,7 +1765,7 @@ class DRBD8(BaseDRBD): """ # TODO: Rewrite to not use a for loop just because there is 'break' - # pylint: disable-msg=W0631 + # pylint: disable=W0631 net_data = (self._lhost, self._lport, self._rhost, self._rport) for minor in (self._aminor,): info = self._GetDevInfo(self._GetShowData(minor)) diff --git a/lib/bootstrap.py b/lib/bootstrap.py index 3e75dfa12..733a8ba98 100644 --- a/lib/bootstrap.py +++ b/lib/bootstrap.py @@ -242,7 +242,7 @@ def _InitFileStorage(file_storage_dir): return file_storage_dir -def InitCluster(cluster_name, mac_prefix, # pylint: disable-msg=R0913 +def InitCluster(cluster_name, mac_prefix, # pylint: disable=R0913 master_netdev, file_storage_dir, shared_file_storage_dir, candidate_pool_size, secondary_ip=None, vg_name=None, beparams=None, nicparams=None, ndparams=None, hvparams=None, diff --git a/lib/build/sphinx_ext.py b/lib/build/sphinx_ext.py index 474721dcc..0d2d2e3cf 100644 --- a/lib/build/sphinx_ext.py +++ b/lib/build/sphinx_ext.py @@ -42,7 +42,7 @@ from ganeti import opcodes from ganeti import ht from ganeti import rapi -import ganeti.rapi.rlib2 # pylint: disable-msg=W0611 +import ganeti.rapi.rlib2 # pylint: disable=W0611 COMMON_PARAM_NAMES = map(compat.fst, opcodes.OpCode.OP_PARAMS) @@ -213,7 +213,7 @@ def PythonEvalRole(role, rawtext, text, lineno, inliner, The expression's result is included as a literal. """ - # pylint: disable-msg=W0102,W0613,W0142 + # pylint: disable=W0102,W0613,W0142 # W0102: Dangerous default value as argument # W0142: Used * or ** magic # W0613: Unused argument @@ -222,7 +222,7 @@ def PythonEvalRole(role, rawtext, text, lineno, inliner, try: result = eval(code, EVAL_NS) - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 msg = inliner.reporter.error("Failed to evaluate %r: %s" % (code, err), line=lineno) return ([inliner.problematic(rawtext, rawtext, msg)], [msg]) diff --git a/lib/cli.py b/lib/cli.py index f55804d04..d7e497e58 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -259,7 +259,7 @@ _PRIONAME_TO_VALUE = dict(_PRIORITY_NAMES) class _Argument: - def __init__(self, min=0, max=None): # pylint: disable-msg=W0622 + def __init__(self, min=0, max=None): # pylint: disable=W0622 self.min = min self.max = max @@ -274,7 +274,7 @@ class ArgSuggest(_Argument): Value can be any of the ones passed to the constructor. """ - # pylint: disable-msg=W0622 + # pylint: disable=W0622 def __init__(self, min=0, max=None, choices=None): _Argument.__init__(self, min=min, max=max) self.choices = choices @@ -462,7 +462,7 @@ def RemoveTags(opts, args): SubmitOpCode(op, opts=opts) -def check_unit(option, opt, value): # pylint: disable-msg=W0613 +def check_unit(option, opt, value): # pylint: disable=W0613 """OptParsers custom converter for units. """ @@ -509,7 +509,7 @@ def _SplitKeyVal(opt, data): return kv_dict -def check_ident_key_val(option, opt, value): # pylint: disable-msg=W0613 +def check_ident_key_val(option, opt, value): # pylint: disable=W0613 """Custom parser for ident:key=val,key=val options. This will store the parsed values as a tuple (ident, {key: val}). As such, @@ -537,7 +537,7 @@ def check_ident_key_val(option, opt, value): # pylint: disable-msg=W0613 return retval -def check_key_val(option, opt, value): # pylint: disable-msg=W0613 +def check_key_val(option, opt, value): # pylint: disable=W0613 """Custom parser class for key=val,key=val options. This will store the parsed values as a dict {key: val}. @@ -546,7 +546,7 @@ def check_key_val(option, opt, value): # pylint: disable-msg=W0613 return _SplitKeyVal(opt, value) -def check_bool(option, opt, value): # pylint: disable-msg=W0613 +def check_bool(option, opt, value): # pylint: disable=W0613 """Custom parser for yes/no options. This will store the parsed value as either True or False. @@ -2363,8 +2363,8 @@ def GenerateTable(headers, fields, separator, data, if unitfields is None: unitfields = [] - numfields = utils.FieldSet(*numfields) # pylint: disable-msg=W0142 - unitfields = utils.FieldSet(*unitfields) # pylint: disable-msg=W0142 + numfields = utils.FieldSet(*numfields) # pylint: disable=W0142 + unitfields = utils.FieldSet(*unitfields) # pylint: disable=W0142 format_fields = [] for field in fields: diff --git a/lib/client/gnt_backup.py b/lib/client/gnt_backup.py index 4b7f81bf6..5999e3267 100644 --- a/lib/client/gnt_backup.py +++ b/lib/client/gnt_backup.py @@ -20,7 +20,7 @@ """Backup related commands""" -# pylint: disable-msg=W0401,W0613,W0614,C0103 +# pylint: disable=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) diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py index 7eb11e53e..04fda7341 100644 --- a/lib/client/gnt_cluster.py +++ b/lib/client/gnt_cluster.py @@ -20,7 +20,7 @@ """Cluster related commands""" -# pylint: disable-msg=W0401,W0613,W0614,C0103 +# pylint: disable=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) @@ -622,7 +622,7 @@ def MasterPing(opts, args): cl = GetClient() cl.QueryClusterInfo() return 0 - except Exception: # pylint: disable-msg=W0703 + except Exception: # pylint: disable=W0703 return 1 @@ -685,14 +685,14 @@ def _RenewCrypto(new_cluster_cert, new_rapi_cert, rapi_cert_filename, OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, rapi_cert_pem) - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 ToStderr("Can't load new RAPI certificate from %s: %s" % (rapi_cert_filename, str(err))) return 1 try: OpenSSL.crypto.load_privatekey(OpenSSL.crypto.FILETYPE_PEM, rapi_cert_pem) - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 ToStderr("Can't load new RAPI private key from %s: %s" % (rapi_cert_filename, str(err))) return 1 @@ -703,7 +703,7 @@ def _RenewCrypto(new_cluster_cert, new_rapi_cert, rapi_cert_filename, if cds_filename: try: cds = utils.ReadFile(cds_filename) - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 ToStderr("Can't load new cluster domain secret from %s: %s" % (cds_filename, str(err))) return 1 diff --git a/lib/client/gnt_debug.py b/lib/client/gnt_debug.py index 0a73525cf..228733b5d 100644 --- a/lib/client/gnt_debug.py +++ b/lib/client/gnt_debug.py @@ -20,7 +20,7 @@ """Debugging commands""" -# pylint: disable-msg=W0401,W0614,C0103 +# pylint: disable=W0401,W0614,C0103 # W0401: Wildcard import ganeti.cli # W0614: Unused import %s from wildcard import (since we need cli) # C0103: Invalid name gnt-backup @@ -90,7 +90,7 @@ def GenericOpCodes(opts, args): ToStdout("Loading...") for job_idx in range(opts.rep_job): for fname in args: - # pylint: disable-msg=W0142 + # pylint: disable=W0142 op_data = simplejson.loads(utils.ReadFile(fname)) op_list = [opcodes.OpCode.LoadOpCode(val) for val in op_data] op_list = op_list * opts.rep_op @@ -564,7 +564,7 @@ def TestJobqueue(opts, _): return 0 -def ListLocks(opts, args): # pylint: disable-msg=W0613 +def ListLocks(opts, args): # pylint: disable=W0613 """List all locks. @param opts: the command line options selected by the user diff --git a/lib/client/gnt_group.py b/lib/client/gnt_group.py index 2fb73e1b0..096bb9934 100644 --- a/lib/client/gnt_group.py +++ b/lib/client/gnt_group.py @@ -20,7 +20,7 @@ """Node group related commands""" -# pylint: disable-msg=W0401,W0614 +# pylint: disable=W0401,W0614 # W0401: Wildcard import ganeti.cli # W0614: Unused import %s from wildcard import (since we need cli) diff --git a/lib/client/gnt_instance.py b/lib/client/gnt_instance.py index 7f51327a5..3d6d68533 100644 --- a/lib/client/gnt_instance.py +++ b/lib/client/gnt_instance.py @@ -20,7 +20,7 @@ """Instance related commands""" -# pylint: disable-msg=W0401,W0614,C0103 +# pylint: disable=W0401,W0614,C0103 # W0401: Wildcard import ganeti.cli # W0614: Unused import %s from wildcard import (since we need cli) # C0103: Invalid name gnt-instance @@ -87,7 +87,7 @@ def _ExpandMultiNames(mode, names, client=None): @raise errors.OpPrereqError: for invalid input parameters """ - # pylint: disable-msg=W0142 + # pylint: disable=W0142 if client is None: client = GetClient() @@ -322,7 +322,7 @@ def BatchCreate(opts, args): json_filename = args[0] try: instance_data = simplejson.loads(utils.ReadFile(json_filename)) - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 ToStderr("Can't parse the instance definition file: %s" % str(err)) return 1 @@ -335,7 +335,7 @@ def BatchCreate(opts, args): # Iterate over the instances and do: # * Populate the specs with default value # * Validate the instance specs - i_names = utils.NiceSort(instance_data.keys()) # pylint: disable-msg=E1103 + i_names = utils.NiceSort(instance_data.keys()) # pylint: disable=E1103 for name in i_names: specs = instance_data[name] specs = _PopulateWithDefaults(specs) diff --git a/lib/client/gnt_job.py b/lib/client/gnt_job.py index 4e11eabb7..4d888ad83 100644 --- a/lib/client/gnt_job.py +++ b/lib/client/gnt_job.py @@ -20,7 +20,7 @@ """Job related commands""" -# pylint: disable-msg=W0401,W0613,W0614,C0103 +# pylint: disable=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) diff --git a/lib/client/gnt_node.py b/lib/client/gnt_node.py index 1847b4162..270aff55e 100644 --- a/lib/client/gnt_node.py +++ b/lib/client/gnt_node.py @@ -20,7 +20,7 @@ """Node related commands""" -# pylint: disable-msg=W0401,W0613,W0614,C0103 +# pylint: disable=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) diff --git a/lib/client/gnt_os.py b/lib/client/gnt_os.py index e80aa6513..3554524ff 100644 --- a/lib/client/gnt_os.py +++ b/lib/client/gnt_os.py @@ -20,7 +20,7 @@ """OS scripts related commands""" -# pylint: disable-msg=W0401,W0613,W0614,C0103 +# pylint: disable=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) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 5b1be95ce..05071be48 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -21,7 +21,7 @@ """Module implementing the master-side code.""" -# pylint: disable-msg=W0201,C0302 +# pylint: disable=W0201,C0302 # W0201 since most LU attributes are defined in CheckPrereq or similar # functions @@ -60,7 +60,7 @@ from ganeti import qlang from ganeti import opcodes from ganeti import ht -import ganeti.masterd.instance # pylint: disable-msg=W0611 +import ganeti.masterd.instance # pylint: disable=W0611 class ResultWithJobs: @@ -131,10 +131,10 @@ class LogicalUnit(object): # Used to force good behavior when calling helper functions self.recalculate_locks = {} # logging - self.Log = processor.Log # pylint: disable-msg=C0103 - self.LogWarning = processor.LogWarning # pylint: disable-msg=C0103 - self.LogInfo = processor.LogInfo # pylint: disable-msg=C0103 - self.LogStep = processor.LogStep # pylint: disable-msg=C0103 + self.Log = processor.Log # pylint: disable=C0103 + self.LogWarning = processor.LogWarning # pylint: disable=C0103 + self.LogInfo = processor.LogInfo # pylint: disable=C0103 + self.LogStep = processor.LogStep # pylint: disable=C0103 # support for dry-run self.dry_run_result = None # support for generic debug attribute @@ -322,7 +322,7 @@ class LogicalUnit(object): """ # API must be kept, thus we ignore the unused argument and could # be a function warnings - # pylint: disable-msg=W0613,R0201 + # pylint: disable=W0613,R0201 return lu_result def _ExpandAndLockInstance(self): @@ -390,7 +390,7 @@ class LogicalUnit(object): del self.recalculate_locks[locking.LEVEL_NODE] -class NoHooksLU(LogicalUnit): # pylint: disable-msg=W0223 +class NoHooksLU(LogicalUnit): # pylint: disable=W0223 """Simple LU which runs no hooks. This LU is intended as a parent for other LogicalUnits which will @@ -757,7 +757,7 @@ def _RunPostHook(lu, node_name): try: hm.RunPhase(constants.HOOKS_PHASE_POST, nodes=[node_name]) except: - # pylint: disable-msg=W0702 + # pylint: disable=W0702 lu.LogWarning("Errors occurred running hooks on %s" % node_name) @@ -1087,7 +1087,7 @@ def _BuildInstanceHookEnvByObject(lu, instance, override=None): } if override: args.update(override) - return _BuildInstanceHookEnv(**args) # pylint: disable-msg=W0142 + return _BuildInstanceHookEnv(**args) # pylint: disable=W0142 def _AdjustCandidatePool(lu, exceptions): @@ -1371,7 +1371,7 @@ def _VerifyCertificate(filename): try: cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, utils.ReadFile(filename)) - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 return (LUClusterVerifyConfig.ETYPE_ERROR, "Failed to load X509 certificate %s: %s" % (filename, err)) @@ -1486,7 +1486,7 @@ class _VerifyErrors(object): if args: msg = msg % args # then format the whole message - if self.op.error_codes: # This is a mix-in. pylint: disable-msg=E1101 + if self.op.error_codes: # This is a mix-in. pylint: disable=E1101 msg = "%s:%s:%s:%s:%s" % (ltype, etxt, itype, item, msg) else: if item: @@ -1495,14 +1495,14 @@ class _VerifyErrors(object): item = "" msg = "%s: %s%s: %s" % (ltype, itype, item, msg) # and finally report it via the feedback_fn - self._feedback_fn(" - %s" % msg) # Mix-in. pylint: disable-msg=E1101 + self._feedback_fn(" - %s" % msg) # Mix-in. pylint: disable=E1101 def _ErrorIf(self, cond, *args, **kwargs): """Log an error message if the passed condition is True. """ cond = (bool(cond) - or self.op.debug_simulate_errors) # pylint: disable-msg=E1101 + or self.op.debug_simulate_errors) # pylint: disable=E1101 if cond: self._Error(*args, **kwargs) # do not mark the operation as failed for WARN cases only @@ -1539,7 +1539,7 @@ class LUClusterVerify(NoHooksLU): for group in groups) # Fix up all parameters - for op in itertools.chain(*jobs): # pylint: disable-msg=W0142 + for op in itertools.chain(*jobs): # pylint: disable=W0142 op.debug_simulate_errors = self.op.debug_simulate_errors op.verbose = self.op.verbose op.error_codes = self.op.error_codes @@ -1801,7 +1801,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): """ node = ninfo.name - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 # main result, nresult should be a non-empty dict test = not nresult or not isinstance(nresult, dict) @@ -1870,7 +1870,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): """ node = ninfo.name - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 ntime = nresult.get(constants.NV_TIME, None) try: @@ -1903,7 +1903,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): return node = ninfo.name - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 # checks vg existence and size > 20G vglist = nresult.get(constants.NV_VGLIST, None) @@ -1940,7 +1940,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): return node = ninfo.name - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 missing = nresult.get(constants.NV_BRIDGES, None) test = not isinstance(missing, list) @@ -1959,7 +1959,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): """ node = ninfo.name - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 test = constants.NV_NODELIST not in nresult _ErrorIf(test, self.ENODESSH, node, @@ -2000,7 +2000,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): available on the instance's node. """ - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 node_current = instanceconfig.primary_node node_vol_should = {} @@ -2200,7 +2200,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): """ node = ninfo.name - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 if drbd_helper: helper_result = nresult.get(constants.NV_DRBDHELPER, None) @@ -2259,7 +2259,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): """ node = ninfo.name - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 remote_os = nresult.get(constants.NV_OSLIST, None) test = (not isinstance(remote_os, list) or @@ -2300,7 +2300,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): """ node = ninfo.name - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 assert not nimg.os_fail, "Entered _VerifyNodeOS with failed OS rpc?" @@ -2370,7 +2370,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): """ node = ninfo.name - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 nimg.lvm_fail = True lvdata = nresult.get(constants.NV_LVLIST, "Missing LV data") @@ -2418,7 +2418,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): """ node = ninfo.name - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 # try to read free memory (from the hypervisor) hv_info = nresult.get(constants.NV_HVINFO, None) @@ -2460,7 +2460,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): list of tuples (success, payload) """ - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 node_disks = {} node_disks_devonly = {} @@ -2568,7 +2568,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): """Verify integrity of the node group, performing various test on nodes. """ - # This method has too many local variables. pylint: disable-msg=R0914 + # This method has too many local variables. pylint: disable=R0914 feedback_fn("* Verifying group '%s'" % self.group_info.name) if not self.my_node_names: @@ -2577,7 +2577,7 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors): return True self.bad = False - _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103 + _ErrorIf = self._ErrorIf # pylint: disable=C0103 verbose = self.op.verbose self._feedback_fn = feedback_fn @@ -4419,7 +4419,7 @@ class LUNodeQuery(NoHooksLU): """Logical unit for querying nodes. """ - # pylint: disable-msg=W0142 + # pylint: disable=W0142 REQ_BGL = False def CheckArguments(self): @@ -4620,7 +4620,7 @@ class _InstanceQuery(_QueryBase): for instance_name in lu.owned_locks(locking.LEVEL_INSTANCE) for group_uuid in lu.cfg.GetInstanceNodeGroups(instance_name)) elif level == locking.LEVEL_NODE: - lu._LockInstancesNodes() # pylint: disable-msg=W0212 + lu._LockInstancesNodes() # pylint: disable=W0212 @staticmethod def _CheckGroupLocks(lu): @@ -4721,7 +4721,7 @@ class LUQuery(NoHooksLU): """Query for resources/items of a certain kind. """ - # pylint: disable-msg=W0142 + # pylint: disable=W0142 REQ_BGL = False def CheckArguments(self): @@ -4743,7 +4743,7 @@ class LUQueryFields(NoHooksLU): """Query for resources/items of a certain kind. """ - # pylint: disable-msg=W0142 + # pylint: disable=W0142 REQ_BGL = False def CheckArguments(self): @@ -4990,7 +4990,7 @@ class LUNodeAdd(LogicalUnit): # later in the procedure; this also means that if the re-add # fails, we are left with a non-offlined, broken node if self.op.readd: - new_node.drained = new_node.offline = False # pylint: disable-msg=W0201 + new_node.drained = new_node.offline = False # pylint: disable=W0201 self.LogInfo("Readding a node, the offline/drained flags were reset") # if we demote the node, we do cleanup later in the procedure new_node.master_candidate = self.master_candidate @@ -6550,7 +6550,7 @@ class LUInstanceQuery(NoHooksLU): """Logical unit for querying instances. """ - # pylint: disable-msg=W0142 + # pylint: disable=W0142 REQ_BGL = False def CheckArguments(self): @@ -8515,7 +8515,7 @@ class LUInstanceCreate(LogicalUnit): joinargs.append(self.op.instance_name) - # pylint: disable-msg=W0142 + # pylint: disable=W0142 self.instance_file_storage_dir = utils.PathJoin(*joinargs) def CheckPrereq(self): @@ -9674,7 +9674,7 @@ class TLReplaceDisks(Tasklet): self.lu.LogWarning("Can't remove old LV: %s" % msg, hint="remove unused LVs manually") - def _ExecDrbd8DiskOnly(self, feedback_fn): # pylint: disable-msg=W0613 + def _ExecDrbd8DiskOnly(self, feedback_fn): # pylint: disable=W0613 """Replace a disk on the primary or secondary for DRBD 8. The algorithm for replace is quite complicated: @@ -12436,7 +12436,7 @@ class LUGroupEvacuate(LogicalUnit): return ResultWithJobs(jobs) -class TagsLU(NoHooksLU): # pylint: disable-msg=W0223 +class TagsLU(NoHooksLU): # pylint: disable=W0223 """Generic tags LU. This is an abstract class which is the parent of all the other tags LUs. @@ -12696,7 +12696,7 @@ class LUTestJqueue(NoHooksLU): # Wait for client to close try: try: - # pylint: disable-msg=E1101 + # pylint: disable=E1101 # Instance of '_socketobject' has no ... member conn.settimeout(cls._CLIENT_CONFIRM_TIMEOUT) conn.recv(1) @@ -12793,7 +12793,7 @@ class IAllocator(object): easy usage """ - # pylint: disable-msg=R0902 + # pylint: disable=R0902 # lots of instance attributes def __init__(self, cfg, rpc, mode, **kwargs): @@ -13130,7 +13130,7 @@ class IAllocator(object): _STRING_LIST = ht.TListOf(ht.TString) _JOB_LIST = ht.TListOf(ht.TListOf(ht.TStrictDict(True, False, { - # pylint: disable-msg=E1101 + # pylint: disable=E1101 # Class '...' has no 'OP_ID' member "OP_ID": ht.TElemOf([opcodes.OpInstanceFailover.OP_ID, opcodes.OpInstanceMigrate.OP_ID, diff --git a/lib/compat.py b/lib/compat.py index 907992057..53ee1fb80 100644 --- a/lib/compat.py +++ b/lib/compat.py @@ -27,13 +27,13 @@ import itertools import operator try: - # pylint: disable-msg=F0401 + # pylint: disable=F0401 import functools except ImportError: functools = None try: - # pylint: disable-msg=F0401 + # pylint: disable=F0401 import roman except ImportError: roman = None @@ -45,9 +45,9 @@ except ImportError: # modules (hmac, for example) which have changed their behavior as well from # one version to the other. try: - # pylint: disable-msg=F0401 + # pylint: disable=F0401 # Yes, we're not using the imports in this module. - # pylint: disable-msg=W0611 + # pylint: disable=W0611 from hashlib import md5 as md5_hash from hashlib import sha1 as sha1_hash # this additional version is needed for compatibility with the hmac module @@ -78,21 +78,21 @@ def _any(seq): try: - # pylint: disable-msg=E0601 - # pylint: disable-msg=W0622 + # pylint: disable=E0601 + # pylint: disable=W0622 all = all except NameError: all = _all try: - # pylint: disable-msg=E0601 - # pylint: disable-msg=W0622 + # pylint: disable=E0601 + # pylint: disable=W0622 any = any except NameError: any = _any -def partition(seq, pred=bool): # pylint: disable-msg=W0622 +def partition(seq, pred=bool): # pylint: disable=W0622 """Partition a list in two, based on the given predicate. """ @@ -102,7 +102,7 @@ def partition(seq, pred=bool): # pylint: disable-msg=W0622 # Even though we're using Python's built-in "partial" function if available, # this one is always defined for testing. -def _partial(func, *args, **keywords): # pylint: disable-msg=W0622 +def _partial(func, *args, **keywords): # pylint: disable=W0622 """Decorator with partial application of arguments and keywords. This function was copied from Python's documentation. @@ -111,7 +111,7 @@ def _partial(func, *args, **keywords): # pylint: disable-msg=W0622 def newfunc(*fargs, **fkeywords): newkeywords = keywords.copy() newkeywords.update(fkeywords) - return func(*(args + fargs), **newkeywords) # pylint: disable-msg=W0142 + return func(*(args + fargs), **newkeywords) # pylint: disable=W0142 newfunc.func = func newfunc.args = args diff --git a/lib/confd/client.py b/lib/confd/client.py index aec2a7f5b..11baa4d22 100644 --- a/lib/confd/client.py +++ b/lib/confd/client.py @@ -45,7 +45,7 @@ confirming what you already got. """ -# pylint: disable-msg=E0203 +# pylint: disable=E0203 # E0203: Access to member %r before its definition, since we use # objects.py which doesn't explicitely initialise its members @@ -156,7 +156,7 @@ class ConfdClient: """ # we are actually called from init, so: - # pylint: disable-msg=W0201 + # pylint: disable=W0201 if not isinstance(peers, list): raise errors.ProgrammerError("peers must be a list") # make a copy of peers, since we're going to shuffle the list, later diff --git a/lib/confd/querylib.py b/lib/confd/querylib.py index 4ad51e788..e231a14e4 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,W0613 + def Exec(self, query): # pylint: disable=R0201,W0613 """Process a single UDP request from a client. Different queries should override this function, which by defaults returns diff --git a/lib/config.py b/lib/config.py index df4f84fa6..fdd77c0d9 100644 --- a/lib/config.py +++ b/lib/config.py @@ -31,7 +31,7 @@ much memory. """ -# pylint: disable-msg=R0904 +# pylint: disable=R0904 # R0904: Too many public methods import os @@ -374,7 +374,7 @@ class ConfigWriter: configuration errors """ - # pylint: disable-msg=R0914 + # pylint: disable=R0914 result = [] seen_macs = [] ports = {} diff --git a/lib/daemon.py b/lib/daemon.py index 7f5e9efcf..f5e18a25b 100644 --- a/lib/daemon.py +++ b/lib/daemon.py @@ -539,12 +539,12 @@ def _BeautifyError(err): err.errno) else: return str(err) - except Exception: # pylint: disable-msg=W0703 + except Exception: # pylint: disable=W0703 logging.exception("Error while handling existing error %s", err) return "%s" % str(err) -def _HandleSigHup(reopen_fn, signum, frame): # pylint: disable-msg=W0613 +def _HandleSigHup(reopen_fn, signum, frame): # pylint: disable=W0613 """Handler for SIGHUP. @param reopen_fn: List of callback functions for reopening log files diff --git a/lib/http/__init__.py b/lib/http/__init__.py index 904982991..2719a38f0 100644 --- a/lib/http/__init__.py +++ b/lib/http/__init__.py @@ -624,7 +624,7 @@ class HttpBase(object): return OpenSSL.SSL.Connection(ctx, sock) - def GetSslCiphers(self): # pylint: disable-msg=R0201 + def GetSslCiphers(self): # pylint: disable=R0201 """Returns the ciphers string for SSL. """ @@ -638,7 +638,7 @@ class HttpBase(object): """ # some parameters are unused, but this is the API - # pylint: disable-msg=W0613 + # pylint: disable=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 09b0ce721..5a7bfac19 100644 --- a/lib/http/auth.py +++ b/lib/http/auth.py @@ -92,7 +92,7 @@ class HttpServerRequestAuthentication(object): """ # today we don't have per-request filtering, but we might want to # add it in the future - # pylint: disable-msg=W0613 + # pylint: disable=W0613 return self.AUTH_REALM def AuthenticationRequired(self, req): @@ -106,7 +106,7 @@ class HttpServerRequestAuthentication(object): """ # Unused argument, method could be a function - # pylint: disable-msg=W0613,R0201 + # pylint: disable=W0613,R0201 return False def PreHandleRequest(self, req): diff --git a/lib/http/server.py b/lib/http/server.py index 52b134064..cb7618596 100644 --- a/lib/http/server.py +++ b/lib/http/server.py @@ -537,7 +537,7 @@ class HttpServer(http.HttpBase, asyncore.dispatcher): """Called for each incoming connection """ - # pylint: disable-msg=W0212 + # pylint: disable=W0212 (connection, client_addr) = self.socket.accept() self._CollectChildren(False) @@ -560,7 +560,7 @@ class HttpServer(http.HttpBase, asyncore.dispatcher): utils.ResetTempfileModule() self.request_executor(self, connection, client_addr) - except Exception: # pylint: disable-msg=W0703 + except Exception: # pylint: disable=W0703 logging.exception("Error while handling request from %s:%s", client_addr[0], client_addr[1]) os._exit(1) diff --git a/lib/hypervisor/hv_base.py b/lib/hypervisor/hv_base.py index 843be2a49..7c4b1b59d 100644 --- a/lib/hypervisor/hv_base.py +++ b/lib/hypervisor/hv_base.py @@ -235,7 +235,7 @@ class BaseHypervisor(object): """ raise NotImplementedError - def MigrationInfo(self, instance): # pylint: disable-msg=R0201,W0613 + def MigrationInfo(self, instance): # pylint: disable=R0201,W0613 """Get instance information to perform a migration. By default assume no information is needed. diff --git a/lib/hypervisor/hv_chroot.py b/lib/hypervisor/hv_chroot.py index 8505cadc5..3d3caeba7 100644 --- a/lib/hypervisor/hv_chroot.py +++ b/lib/hypervisor/hv_chroot.py @@ -29,7 +29,7 @@ import time import logging from ganeti import constants -from ganeti import errors # pylint: disable-msg=W0611 +from ganeti import errors # pylint: disable=W0611 from ganeti import utils from ganeti import objects from ganeti.hypervisor import hv_base @@ -247,7 +247,7 @@ class ChrootManager(hv_base.BaseHypervisor): return self.GetLinuxNodeInfo() @classmethod - def GetInstanceConsole(cls, instance, # pylint: disable-msg=W0221 + def GetInstanceConsole(cls, instance, # pylint: disable=W0221 hvparams, beparams, root_dir=None): """Return information for connecting to the console of an instance. diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py index 9d56bd2fc..8fdc52f1a 100644 --- a/lib/hypervisor/hv_lxc.py +++ b/lib/hypervisor/hv_lxc.py @@ -29,7 +29,7 @@ import time import logging from ganeti import constants -from ganeti import errors # pylint: disable-msg=W0611 +from ganeti import errors # pylint: disable=W0611 from ganeti import utils from ganeti import objects from ganeti.hypervisor import hv_base diff --git a/lib/jqueue.py b/lib/jqueue.py index bf65d5bc7..7138993f3 100644 --- a/lib/jqueue.py +++ b/lib/jqueue.py @@ -37,7 +37,7 @@ import threading import itertools try: - # pylint: disable-msg=E0611 + # pylint: disable=E0611 from pyinotify import pyinotify except ImportError: import pyinotify @@ -177,7 +177,7 @@ class _QueuedJob(object): @ivar writable: Whether the job is allowed to be modified """ - # pylint: disable-msg=W0212 + # pylint: disable=W0212 __slots__ = ["queue", "id", "ops", "log_serial", "ops_iter", "cur_opctx", "received_timestamp", "start_timestamp", "end_timestamp", "__weakref__", "processor_lock", "writable"] @@ -1048,7 +1048,7 @@ class _JobProcessor(object): logging.exception("%s: Canceling job", opctx.log_prefix) assert op.status == constants.OP_STATUS_CANCELING return (constants.OP_STATUS_CANCELING, None) - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 logging.exception("%s: Caught exception in %s", opctx.log_prefix, opctx.summary) return (constants.OP_STATUS_ERROR, _EncodeOpError(err)) @@ -1241,7 +1241,7 @@ class _JobQueueWorker(workerpool.BaseWorker): """The actual job workers. """ - def RunTask(self, job): # pylint: disable-msg=W0221 + def RunTask(self, job): # pylint: disable=W0221 """Job executor. @type job: L{_QueuedJob} @@ -1358,7 +1358,7 @@ class _JobDependencyManager: self._lock = locking.SharedLock("JobDepMgr") @locking.ssynchronized(_LOCK, shared=1) - def GetLockInfo(self, requested): # pylint: disable-msg=W0613 + def GetLockInfo(self, requested): # pylint: disable=W0613 """Retrieves information about waiting jobs. @type requested: set @@ -1481,7 +1481,7 @@ def _RequireOpenQueue(fn): """ def wrapper(self, *args, **kwargs): - # pylint: disable-msg=W0212 + # pylint: disable=W0212 assert self._queue_filelock is not None, "Queue should be open" return fn(self, *args, **kwargs) return wrapper @@ -1945,7 +1945,7 @@ class JobQueue(object): try: data = serializer.LoadJson(raw_data) job = _QueuedJob.Restore(self, data, writable) - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 raise errors.JobFileCorrupted(err) return job diff --git a/lib/locking.py b/lib/locking.py index 9f2477150..26345632e 100644 --- a/lib/locking.py +++ b/lib/locking.py @@ -20,7 +20,7 @@ """Module implementing the Ganeti locking code.""" -# pylint: disable-msg=W0212 +# pylint: disable=W0212 # W0212 since e.g. LockSet methods use (a lot) the internals of # SharedLock @@ -276,7 +276,7 @@ class SingleNotifyPipeCondition(_BaseCondition): if self._nwaiters == 0: self._Cleanup() - def notifyAll(self): # pylint: disable-msg=C0103 + def notifyAll(self): # pylint: disable=C0103 """Close the writing side of the pipe to notify all waiters. """ @@ -333,7 +333,7 @@ class PipeCondition(_BaseCondition): self._check_owned() self._waiters.remove(threading.currentThread()) - def notifyAll(self): # pylint: disable-msg=C0103 + def notifyAll(self): # pylint: disable=C0103 """Notify all currently waiting threads. """ @@ -1507,7 +1507,7 @@ class GanetiLockManager: # the test cases. return compat.any((self._is_owned(l) for l in LEVELS[level + 1:])) - def _BGL_owned(self): # pylint: disable-msg=C0103 + def _BGL_owned(self): # pylint: disable=C0103 """Check if the current thread owns the BGL. Both an exclusive or a shared acquisition work. @@ -1516,7 +1516,7 @@ class GanetiLockManager: return BGL in self.__keyring[LEVEL_CLUSTER]._list_owned() @staticmethod - def _contains_BGL(level, names): # pylint: disable-msg=C0103 + def _contains_BGL(level, names): # pylint: disable=C0103 """Check if the level contains the BGL. Check if acting on the given level and set of names will change diff --git a/lib/luxi.py b/lib/luxi.py index cfde21e4e..4371613a1 100644 --- a/lib/luxi.py +++ b/lib/luxi.py @@ -278,9 +278,9 @@ def ParseRequest(msg): logging.error("LUXI request not a dict: %r", msg) raise ProtocolError("Invalid LUXI request (not a dict)") - method = request.get(KEY_METHOD, None) # pylint: disable-msg=E1103 - args = request.get(KEY_ARGS, None) # pylint: disable-msg=E1103 - version = request.get(KEY_VERSION, None) # pylint: disable-msg=E1103 + method = request.get(KEY_METHOD, None) # pylint: disable=E1103 + args = request.get(KEY_ARGS, None) # pylint: disable=E1103 + version = request.get(KEY_VERSION, None) # pylint: disable=E1103 if method is None or args is None: logging.error("LUXI request missing method or arguments: %r", msg) @@ -309,7 +309,7 @@ def ParseResponse(msg): raise ProtocolError("Invalid response from server: %r" % data) return (data[KEY_SUCCESS], data[KEY_RESULT], - data.get(KEY_VERSION, None)) # pylint: disable-msg=E1103 + data.get(KEY_VERSION, None)) # pylint: disable=E1103 def FormatResponse(success, result, version=None): @@ -417,7 +417,7 @@ class Client(object): old_transp = self.transport self.transport = None old_transp.Close() - except Exception: # pylint: disable-msg=W0703 + except Exception: # pylint: disable=W0703 pass def _SendMethodCall(self, data): diff --git a/lib/mcpu.py b/lib/mcpu.py index 4fcd6fdcb..89046c60c 100644 --- a/lib/mcpu.py +++ b/lib/mcpu.py @@ -122,7 +122,7 @@ class LockAttemptTimeoutStrategy(object): return timeout -class OpExecCbBase: # pylint: disable-msg=W0232 +class OpExecCbBase: # pylint: disable=W0232 """Base class for OpCode execution callbacks. """ diff --git a/lib/objects.py b/lib/objects.py index 5615d4700..ab55b3d2a 100644 --- a/lib/objects.py +++ b/lib/objects.py @@ -26,7 +26,7 @@ pass to and from external parties. """ -# pylint: disable-msg=E0203,W0201 +# pylint: disable=E0203,W0201 # E0203: Access to member %r before its definition, since we use # objects.py which doesn't explicitely initialise its members @@ -170,7 +170,7 @@ class ConfigObject(object): raise errors.ConfigurationError("Invalid object passed to FromDict:" " expected dict, got %s" % type(val)) val_str = dict([(str(k), v) for k, v in val.iteritems()]) - obj = cls(**val_str) # pylint: disable-msg=W0142 + obj = cls(**val_str) # pylint: disable=W0142 return obj @staticmethod @@ -965,7 +965,7 @@ class Node(TaggableObject): """Fill defaults for missing configuration values. """ - # pylint: disable-msg=E0203 + # pylint: disable=E0203 # because these are "defined" via slots, not manually if self.master_capable is None: self.master_capable = True @@ -1095,7 +1095,7 @@ class Cluster(TaggableObject): """Fill defaults for missing configuration values. """ - # pylint: disable-msg=E0203 + # pylint: disable=E0203 # because these are "defined" via slots, not manually if self.hvparams is None: self.hvparams = constants.HVC_DEFAULTS diff --git a/lib/opcodes.py b/lib/opcodes.py index c999bdfca..020301aeb 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -31,7 +31,7 @@ opcodes. # this are practically structures, so disable the message about too # few public methods: -# pylint: disable-msg=R0903 +# pylint: disable=R0903 import logging import re @@ -299,7 +299,7 @@ class BaseOpCode(object): field handling. """ - # pylint: disable-msg=E1101 + # pylint: disable=E1101 # as OP_ID is dynamically defined __metaclass__ = _AutoOpParamSlots @@ -473,7 +473,7 @@ class OpCode(BaseOpCode): @ivar priority: Opcode priority for queue """ - # pylint: disable-msg=E1101 + # pylint: disable=E1101 # as OP_ID is dynamically defined WITH_LU = True OP_PARAMS = [ diff --git a/lib/qlang.py b/lib/qlang.py index db0a59d35..bd2a3fd5f 100644 --- a/lib/qlang.py +++ b/lib/qlang.py @@ -32,7 +32,7 @@ converted to callable functions by L{query._CompileFilter}. """ import re -import string # pylint: disable-msg=W0402 +import string # pylint: disable=W0402 import logging import pyparsing as pyp diff --git a/lib/query.py b/lib/query.py index ae7da5aa6..7a9360c87 100644 --- a/lib/query.py +++ b/lib/query.py @@ -137,7 +137,7 @@ _VTToQFT = { _SERIAL_NO_DOC = "%s object serial number, incremented on each modification" -def _GetUnknownField(ctx, item): # pylint: disable-msg=W0613 +def _GetUnknownField(ctx, item): # pylint: disable=W0613 """Gets the contents of an unknown field. """ @@ -260,7 +260,7 @@ class _FilterHints: if op != qlang.OP_OR: self._NeedAllNames() - def NoteUnaryOp(self, op): # pylint: disable-msg=W0613 + def NoteUnaryOp(self, op): # pylint: disable=W0613 """Called when handling an unary operation. @type op: string @@ -337,7 +337,7 @@ class _FilterCompilerHelper: """Converts a query filter to a callable usable for filtering. """ - # String statement has no effect, pylint: disable-msg=W0105 + # String statement has no effect, pylint: disable=W0105 #: How deep filters can be nested _LEVELS_MAX = 10 @@ -546,7 +546,7 @@ class _FilterCompilerHelper: @param operands: List of operands """ - # Unused arguments, pylint: disable-msg=W0613 + # Unused arguments, pylint: disable=W0613 try: (name, value) = operands except (ValueError, TypeError): @@ -1062,7 +1062,7 @@ def _GetGroup(cb): return fn -def _GetNodeGroup(ctx, node, ng): # pylint: disable-msg=W0613 +def _GetNodeGroup(ctx, node, ng): # pylint: disable=W0613 """Returns the name of a node's group. @type ctx: L{NodeQueryData} @@ -1408,7 +1408,7 @@ def _GetInstNic(index, cb): return fn -def _GetInstNicIp(ctx, _, nic): # pylint: disable-msg=W0613 +def _GetInstNicIp(ctx, _, nic): # pylint: disable=W0613 """Get a NIC's IP address. @type ctx: L{InstanceQueryData} diff --git a/lib/rapi/baserlib.py b/lib/rapi/baserlib.py index 5f43e0af4..77dff3387 100644 --- a/lib/rapi/baserlib.py +++ b/lib/rapi/baserlib.py @@ -23,7 +23,7 @@ """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # C0103: Invalid name, since the R_* names are not conforming @@ -220,7 +220,7 @@ def FillOpcode(opcls, body, static, rename=None): params = dict((str(key), value) for (key, value) in params.items()) try: - op = opcls(**params) # pylint: disable-msg=W0142 + op = opcls(**params) # pylint: disable=W0142 op.Validate(False) except (errors.OpPrereqError, TypeError), err: raise http.HttpBadRequest("Invalid body parameters: %s" % err) diff --git a/lib/rapi/client.py b/lib/rapi/client.py index a4be072db..dac670b1b 100644 --- a/lib/rapi/client.py +++ b/lib/rapi/client.py @@ -261,7 +261,7 @@ def GenericCurlConfig(verbose=False, use_signal=False, return _ConfigCurl -class GanetiRapiClient(object): # pylint: disable-msg=R0904 +class GanetiRapiClient(object): # pylint: disable=R0904 """Ganeti RAPI client. """ diff --git a/lib/rapi/connector.py b/lib/rapi/connector.py index 34c13fd1b..499e2e69f 100644 --- a/lib/rapi/connector.py +++ b/lib/rapi/connector.py @@ -22,7 +22,7 @@ """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # C0103: Invalid name, since the R_* names are not conforming diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py index fb32e8090..9e9f2a1f3 100644 --- a/lib/rapi/rlib2.py +++ b/lib/rapi/rlib2.py @@ -51,7 +51,7 @@ PUT should be prefered over POST. """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # C0103: Invalid name, since the R_* names are not conforming @@ -1005,7 +1005,7 @@ def _ParseInstanceReplaceDisksRequest(name, data): except KeyError: pass else: - if not ht.TListOf(ht.TInt)(raw_disks): # pylint: disable-msg=E1102 + if not ht.TListOf(ht.TInt)(raw_disks): # pylint: disable=E1102 # Backwards compatibility for strings of the format "1, 2, 3" try: data["disks"] = [int(part) for part in raw_disks.split(",")] @@ -1368,7 +1368,7 @@ class _R_Tags(baserlib.R_Generic): Example: ["tag1", "tag2", "tag3"] """ - # pylint: disable-msg=W0212 + # pylint: disable=W0212 return baserlib._Tags_GET(self.TAG_LEVEL, name=self.name) def PUT(self): @@ -1378,7 +1378,7 @@ class _R_Tags(baserlib.R_Generic): you'll have back a job id. """ - # pylint: disable-msg=W0212 + # pylint: disable=W0212 if "tag" not in self.queryargs: raise http.HttpBadRequest("Please specify tag(s) to add using the" " the 'tag' parameter") @@ -1394,7 +1394,7 @@ class _R_Tags(baserlib.R_Generic): /tags?tag=[tag]&tag=[tag] """ - # pylint: disable-msg=W0212 + # pylint: disable=W0212 if "tag" not in self.queryargs: # no we not gonna delete all tags raise http.HttpBadRequest("Cannot delete all tags - please specify" diff --git a/lib/rpc.py b/lib/rpc.py index c93c16d2b..60a30ab0e 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -23,7 +23,7 @@ """ -# pylint: disable-msg=C0103,R0201,R0904 +# pylint: disable=C0103,R0201,R0904 # C0103: Invalid name, since call_ are not valid # R0201: Method could be a function, we keep all rpcs instance methods # as not to change them back and forth between static/instance methods @@ -48,7 +48,7 @@ from ganeti import ssconf from ganeti import runtime # pylint has a bug here, doesn't see this import -import ganeti.http.client # pylint: disable-msg=W0611 +import ganeti.http.client # pylint: disable=W0611 # Timeout for connecting to nodes (seconds) @@ -262,7 +262,7 @@ class RpcResult(object): args = (msg, ecode) else: args = (msg, ) - raise ec(*args) # pylint: disable-msg=W0142 + raise ec(*args) # pylint: disable=W0142 def _AddressLookup(node_list, diff --git a/lib/runtime.py b/lib/runtime.py index 6108e2671..9e478ec5e 100644 --- a/lib/runtime.py +++ b/lib/runtime.py @@ -175,14 +175,14 @@ def GetEnts(resolver=GetentResolver): """ # We need to use the global keyword here - global _priv # pylint: disable-msg=W0603 + global _priv # pylint: disable=W0603 if not _priv: _priv_lock.acquire() try: if not _priv: # W0621: Redefine '_priv' from outer scope (used for singleton) - _priv = resolver() # pylint: disable-msg=W0621 + _priv = resolver() # pylint: disable=W0621 finally: _priv_lock.release() diff --git a/lib/serializer.py b/lib/serializer.py index 81f1add97..ff27261aa 100644 --- a/lib/serializer.py +++ b/lib/serializer.py @@ -24,7 +24,7 @@ This module introduces a simple abstraction over the serialization backend (currently json). """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # C0103: Invalid name, since pylint doesn't see that Dump points to a # function and not a constant @@ -147,7 +147,7 @@ def LoadSignedJson(txt, key): raise errors.SignatureError("Invalid external message") if callable(key): - # pylint: disable-msg=E1103 + # pylint: disable=E1103 key_selector = signed_dict.get("key_selector", None) hmac_key = key(key_selector) if not hmac_key: diff --git a/lib/server/confd.py b/lib/server/confd.py index fe5f7e11b..d25a67715 100644 --- a/lib/server/confd.py +++ b/lib/server/confd.py @@ -26,7 +26,7 @@ It uses UDP+HMAC for authentication with a global cluster key. """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # C0103: Invalid name ganeti-confd import os @@ -35,7 +35,7 @@ import logging import time try: - # pylint: disable-msg=E0611 + # pylint: disable=E0611 from pyinotify import pyinotify except ImportError: import pyinotify @@ -265,7 +265,7 @@ def PrepConfd(options, _): # TODO: clarify how the server and reloader variables work (they are # not used) - # pylint: disable-msg=W0612 + # pylint: disable=W0612 mainloop = daemon.Mainloop() # Asyncronous confd UDP server @@ -285,7 +285,7 @@ def PrepConfd(options, _): return mainloop -def ExecConfd(options, args, prep_data): # pylint: disable-msg=W0613 +def ExecConfd(options, args, prep_data): # pylint: disable=W0613 """Main confd function, executed with PID file held """ diff --git a/lib/server/masterd.py b/lib/server/masterd.py index 17eabf85f..27bf561c4 100644 --- a/lib/server/masterd.py +++ b/lib/server/masterd.py @@ -26,7 +26,7 @@ inheritance from parent classes requires it. """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # C0103: Invalid name ganeti-masterd import grp @@ -66,7 +66,7 @@ EXIT_NODESETUP_ERROR = constants.EXIT_NODESETUP_ERROR class ClientRequestWorker(workerpool.BaseWorker): - # pylint: disable-msg=W0221 + # pylint: disable=W0221 def RunTask(self, server, message, client): """Process the request. @@ -103,7 +103,7 @@ class ClientRequestWorker(workerpool.BaseWorker): client.send_message(reply) # awake the main thread so that it can write out the data. server.awaker.signal() - except: # pylint: disable-msg=W0702 + except: # pylint: disable=W0702 logging.exception("Send error") client.close_log() @@ -189,7 +189,7 @@ class ClientOps: def __init__(self, server): self.server = server - def handle_request(self, method, args): # pylint: disable-msg=R0911 + def handle_request(self, method, args): # pylint: disable=R0911 queue = self.server.context.jobqueue # TODO: Parameter validation @@ -374,7 +374,7 @@ class GanetiContext(object): This class creates and holds common objects shared by all threads. """ - # pylint: disable-msg=W0212 + # pylint: disable=W0212 # we do want to ensure a singleton here _instance = None @@ -613,7 +613,7 @@ def PrepMasterd(options, _): return (mainloop, master) -def ExecMasterd(options, args, prep_data): # pylint: disable-msg=W0613 +def ExecMasterd(options, args, prep_data): # pylint: disable=W0613 """Main master daemon function, executed with the PID file held. """ diff --git a/lib/server/noded.py b/lib/server/noded.py index 580467ae9..e852ca90d 100644 --- a/lib/server/noded.py +++ b/lib/server/noded.py @@ -21,7 +21,7 @@ """Ganeti node daemon""" -# pylint: disable-msg=C0103,W0142 +# pylint: disable=C0103,W0142 # C0103: Functions in this module need to have a given name structure, # and the name of the daemon doesn't match @@ -49,7 +49,7 @@ from ganeti import storage from ganeti import serializer from ganeti import netutils -import ganeti.http.server # pylint: disable-msg=W0611 +import ganeti.http.server # pylint: disable=W0611 queue_lock = None @@ -61,7 +61,7 @@ def _PrepareQueueLock(): @return: None for success, otherwise an exception object """ - global queue_lock # pylint: disable-msg=W0603 + global queue_lock # pylint: disable=W0603 if queue_lock is not None: return None @@ -129,7 +129,7 @@ class NodeHttpServer(http.server.HttpServer): """ # too many public methods, and unused args - all methods get params # due to the API - # pylint: disable-msg=R0904,W0613 + # pylint: disable=R0904,W0613 def __init__(self, *args, **kwargs): http.server.HttpServer.__init__(self, *args, **kwargs) self.noded_pid = os.getpid() @@ -1019,7 +1019,7 @@ def PrepNoded(options, _): return (mainloop, server) -def ExecNoded(options, args, prep_data): # pylint: disable-msg=W0613 +def ExecNoded(options, args, prep_data): # pylint: disable=W0613 """Main node daemon function, executed with the PID file held. """ diff --git a/lib/server/rapi.py b/lib/server/rapi.py index b3a71aa08..6a8a76aee 100644 --- a/lib/server/rapi.py +++ b/lib/server/rapi.py @@ -22,7 +22,7 @@ """ -# pylint: disable-msg=C0103,W0142 +# pylint: disable=C0103,W0142 # C0103: Invalid name ganeti-watcher @@ -34,7 +34,7 @@ import os.path import errno try: - from pyinotify import pyinotify # pylint: disable-msg=E0611 + from pyinotify import pyinotify # pylint: disable=E0611 except ImportError: import pyinotify @@ -49,7 +49,7 @@ from ganeti import compat from ganeti import utils from ganeti.rapi import connector -import ganeti.http.auth # pylint: disable-msg=W0611 +import ganeti.http.auth # pylint: disable=W0611 import ganeti.http.server @@ -90,7 +90,7 @@ class RemoteApiHttpServer(http.auth.HttpServerRequestAuthentication, AUTH_REALM = "Ganeti Remote API" def __init__(self, *args, **kwargs): - # pylint: disable-msg=W0233 + # pylint: disable=W0233 # it seems pylint doesn't see the second parent class there http.server.HttpServer.__init__(self, *args, **kwargs) http.auth.HttpServerRequestAuthentication.__init__(self) @@ -118,7 +118,7 @@ class RemoteApiHttpServer(http.auth.HttpServerRequestAuthentication, users = http.auth.ParsePasswordFile(contents) - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 # We don't care about the type of exception logging.error("Error while parsing %s: %s", filename, err) return False @@ -321,14 +321,14 @@ def PrepRapi(options, _): server.LoadUsers(constants.RAPI_USERS_FILE) - # pylint: disable-msg=E1101 + # pylint: disable=E1101 # it seems pylint doesn't see the second parent class there server.Start() return (mainloop, server) -def ExecRapi(options, args, prep_data): # pylint: disable-msg=W0613 +def ExecRapi(options, args, prep_data): # pylint: disable=W0613 """Main remote API function, executed with the PID file held. """ diff --git a/lib/storage.py b/lib/storage.py index cf8768636..d382be53c 100644 --- a/lib/storage.py +++ b/lib/storage.py @@ -23,7 +23,7 @@ """ -# pylint: disable-msg=W0232,R0201 +# pylint: disable=W0232,R0201 # W0232, since we use these as singletons rather than object holding # data @@ -58,7 +58,7 @@ class _Base: """ raise NotImplementedError() - def Modify(self, name, changes): # pylint: disable-msg=W0613 + def Modify(self, name, changes): # pylint: disable=W0613 """Modifies an entity within the storage unit. @type name: string @@ -84,7 +84,7 @@ class _Base: raise NotImplementedError() -class FileStorage(_Base): # pylint: disable-msg=W0223 +class FileStorage(_Base): # pylint: disable=W0223 """File storage unit. """ @@ -161,7 +161,7 @@ class FileStorage(_Base): # pylint: disable-msg=W0223 return values -class _LvmBase(_Base): # pylint: disable-msg=W0223 +class _LvmBase(_Base): # pylint: disable=W0223 """Base class for LVM storage containers. @cvar LIST_FIELDS: list of tuples consisting of three elements: SF_* @@ -256,7 +256,7 @@ class _LvmBase(_Base): # pylint: disable-msg=W0223 if callable(mapper): # we got a function, call it with all the declared fields - val = mapper(*values) # pylint: disable-msg=W0142 + val = mapper(*values) # pylint: disable=W0142 elif len(values) == 1: assert mapper is None, ("Invalid mapper value (neither callable" " nor None) for one-element fields") @@ -347,7 +347,7 @@ def _LvmPvGetAllocatable(attr): return False -class LvmPvStorage(_LvmBase): # pylint: disable-msg=W0223 +class LvmPvStorage(_LvmBase): # pylint: disable=W0223 """LVM Physical Volume storage unit. """ diff --git a/lib/utils/__init__.py b/lib/utils/__init__.py index d0df82173..6167794a3 100644 --- a/lib/utils/__init__.py +++ b/lib/utils/__init__.py @@ -26,7 +26,7 @@ the command line scripts. """ -# Allow wildcard import in pylint: disable-msg=W0401 +# Allow wildcard import in pylint: disable=W0401 import os import re @@ -573,7 +573,7 @@ class SignalWakeupFd(object): _set_wakeup_fd_fn = signal.set_wakeup_fd except AttributeError: # Not supported - def _SetWakeupFd(self, _): # pylint: disable-msg=R0201 + def _SetWakeupFd(self, _): # pylint: disable=R0201 return -1 else: def _SetWakeupFd(self, fd): diff --git a/lib/utils/log.py b/lib/utils/log.py index 1cc6d82c7..281f59045 100644 --- a/lib/utils/log.py +++ b/lib/utils/log.py @@ -51,13 +51,13 @@ class _ReopenableLogHandler(logging.handlers.BaseRotatingHandler): self._reopen = False - def shouldRollover(self, _): # pylint: disable-msg=C0103 + def shouldRollover(self, _): # pylint: disable=C0103 """Determine whether log file should be reopened. """ return self._reopen or not self.stream - def doRollover(self): # pylint: disable-msg=C0103 + def doRollover(self): # pylint: disable=C0103 """Reopens the log file. """ @@ -88,7 +88,7 @@ def _LogErrorsToConsole(base): This needs to be in a function for unittesting. """ - class wrapped(base): # pylint: disable-msg=C0103 + class wrapped(base): # pylint: disable=C0103 """Log handler that doesn't fallback to stderr. When an error occurs while writing on the logfile, logging.FileHandler @@ -108,7 +108,7 @@ def _LogErrorsToConsole(base): assert not hasattr(self, "_console") self._console = console - def handleError(self, record): # pylint: disable-msg=C0103 + def handleError(self, record): # pylint: disable=C0103 """Handle errors which occur during an emit() call. Try to handle errors with FileHandler method, if it fails write to @@ -117,13 +117,13 @@ def _LogErrorsToConsole(base): """ try: base.handleError(record) - except Exception: # pylint: disable-msg=W0703 + except Exception: # pylint: disable=W0703 if self._console: try: - # Ignore warning about "self.format", pylint: disable-msg=E1101 + # Ignore warning about "self.format", pylint: disable=E1101 self._console.write("Cannot log message:\n%s\n" % self.format(record)) - except Exception: # pylint: disable-msg=W0703 + except Exception: # pylint: disable=W0703 # Log handler tried everything it could, now just give up pass diff --git a/lib/utils/mlock.py b/lib/utils/mlock.py index a8fe5b70e..ea14d6848 100644 --- a/lib/utils/mlock.py +++ b/lib/utils/mlock.py @@ -28,7 +28,7 @@ import logging from ganeti import errors try: - # pylint: disable-msg=F0401 + # pylint: disable=F0401 import ctypes except ImportError: ctypes = None @@ -65,11 +65,11 @@ def Mlockall(_ctypes=ctypes): # By declaring this variable as a pointer to an integer we can then access # its value correctly, should the mlockall call fail, in order to see what # the actual error code was. - # pylint: disable-msg=W0212 + # pylint: disable=W0212 libc.__errno_location.restype = _ctypes.POINTER(_ctypes.c_int) if libc.mlockall(_MCL_CURRENT | _MCL_FUTURE): - # pylint: disable-msg=W0212 + # pylint: disable=W0212 logging.error("Cannot set memory lock: %s", os.strerror(libc.__errno_location().contents.value)) return diff --git a/lib/utils/process.py b/lib/utils/process.py index 789376101..a45875532 100644 --- a/lib/utils/process.py +++ b/lib/utils/process.py @@ -57,7 +57,7 @@ def DisableFork(): """Disables the use of fork(2). """ - global _no_fork # pylint: disable-msg=W0603 + global _no_fork # pylint: disable=W0603 _no_fork = True @@ -342,7 +342,7 @@ def StartDaemon(cmd, env=None, cwd="/", output=None, output_fd=None, output, output_fd, pidfile) finally: # Well, maybe child process failed - os._exit(1) # pylint: disable-msg=W0212 + os._exit(1) # pylint: disable=W0212 finally: utils_wrapper.CloseFdNoError(errpipe_write) @@ -396,7 +396,7 @@ def _StartDaemonChild(errpipe_read, errpipe_write, pid = os.fork() if pid != 0: # Exit first child process - os._exit(0) # pylint: disable-msg=W0212 + os._exit(0) # pylint: disable=W0212 # Make sure pipe is closed on execv* (and thereby notifies # original process) @@ -431,15 +431,15 @@ def _StartDaemonChild(errpipe_read, errpipe_write, os.execvp(args[0], args) else: os.execvpe(args[0], args, env) - except: # pylint: disable-msg=W0702 + except: # pylint: disable=W0702 try: # Report errors to original process WriteErrorToFD(errpipe_write, str(sys.exc_info()[1])) - except: # pylint: disable-msg=W0702 + except: # pylint: disable=W0702 # Ignore errors in error handling pass - os._exit(1) # pylint: disable-msg=W0212 + os._exit(1) # pylint: disable=W0212 def WriteErrorToFD(fd, err): @@ -699,7 +699,7 @@ def RunParts(dir_name, env=None, reset_env=False): else: try: result = RunCmd([fname], env=env, reset_env=reset_env) - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 rr.append((relname, constants.RUNPARTS_ERR, str(err))) else: rr.append((relname, constants.RUNPARTS_RUN, result)) @@ -850,7 +850,7 @@ def Daemonize(logfile): process and a callable to reopen log files """ - # pylint: disable-msg=W0212 + # pylint: disable=W0212 # yes, we really want os._exit # TODO: do another attempt to merge Daemonize and StartDaemon, or at @@ -975,12 +975,12 @@ def RunInSeparateProcess(fn, *args): # Call function result = int(bool(fn(*args))) assert result in (0, 1) - except: # pylint: disable-msg=W0702 + except: # pylint: disable=W0702 logging.exception("Error while calling function in separate process") # 0 and 1 are reserved for the return value result = 33 - os._exit(result) # pylint: disable-msg=W0212 + os._exit(result) # pylint: disable=W0212 # Parent process diff --git a/lib/utils/retry.py b/lib/utils/retry.py index 4e36332e0..cc7541cff 100644 --- a/lib/utils/retry.py +++ b/lib/utils/retry.py @@ -160,7 +160,7 @@ def Retry(fn, delay, timeout, args=None, wait_fn=time.sleep, while True: retry_args = [] try: - # pylint: disable-msg=W0142 + # pylint: disable=W0142 return fn(*args) except RetryAgain, err: retry_args = err.args @@ -171,7 +171,7 @@ def Retry(fn, delay, timeout, args=None, wait_fn=time.sleep, remaining_time = end_time - _time_fn() if remaining_time < 0.0: - # pylint: disable-msg=W0142 + # pylint: disable=W0142 raise RetryTimeout(*retry_args) assert remaining_time >= 0.0 @@ -208,7 +208,7 @@ def SimpleRetry(expected, fn, delay, timeout, args=None, wait_fn=time.sleep, rdict = {} def helper(*innerargs): - # pylint: disable-msg=W0142 + # pylint: disable=W0142 result = rdict["result"] = fn(*innerargs) if not ((callable(expected) and expected(result)) or result == expected): raise RetryAgain() diff --git a/lib/utils/text.py b/lib/utils/text.py index ab9c427a4..7ec049e95 100644 --- a/lib/utils/text.py +++ b/lib/utils/text.py @@ -463,7 +463,7 @@ class LineSplitter: if args: # Python 2.4 doesn't have functools.partial yet self._line_fn = \ - lambda line: line_fn(line, *args) # pylint: disable-msg=W0142 + lambda line: line_fn(line, *args) # pylint: disable=W0142 else: self._line_fn = line_fn diff --git a/lib/utils/wrapper.py b/lib/utils/wrapper.py index 6cf16541f..256d2f1d6 100644 --- a/lib/utils/wrapper.py +++ b/lib/utils/wrapper.py @@ -181,7 +181,7 @@ def ResetTempfileModule(): a temporary name. """ - # pylint: disable-msg=W0212 + # pylint: disable=W0212 if hasattr(tempfile, "_once_lock") and hasattr(tempfile, "_name_sequence"): tempfile._once_lock.acquire() try: diff --git a/lib/watcher/__init__.py b/lib/watcher/__init__.py index 323283b5b..64c3f626f 100644 --- a/lib/watcher/__init__.py +++ b/lib/watcher/__init__.py @@ -50,7 +50,7 @@ from ganeti import objects from ganeti import ssconf from ganeti import ht -import ganeti.rapi.client # pylint: disable-msg=W0611 +import ganeti.rapi.client # pylint: disable=W0611 from ganeti.watcher import nodemaint from ganeti.watcher import state @@ -106,7 +106,7 @@ def RunWatcherHooks(): try: results = utils.RunParts(hooks_dir) - except Exception: # pylint: disable-msg=W0703 + except Exception: # pylint: disable=W0703 logging.exception("RunParts %s failed: %s", hooks_dir) return @@ -193,7 +193,7 @@ def _CheckInstances(cl, notepad, instances): logging.info("Restarting instance '%s' (attempt #%s)", inst.name, n + 1) inst.Restart(cl) - except Exception: # pylint: disable-msg=W0703 + except Exception: # pylint: disable=W0703 logging.exception("Error while restarting instance '%s'", inst.name) else: started.add(inst.name) @@ -255,7 +255,7 @@ def _CheckDisks(cl, notepad, nodes, instances, started): try: logging.info("Activating disks for instance '%s'", inst.name) inst.ActivateDisks(cl) - except Exception: # pylint: disable-msg=W0703 + except Exception: # pylint: disable=W0703 logging.exception("Error while activating disks for instance '%s'", inst.name) @@ -313,7 +313,7 @@ def _VerifyDisks(cl, uuid, nodes, instances): try: cli.PollJob(job_id, cl=cl, feedback_fn=logging.debug) - except Exception: # pylint: disable-msg=W0703 + except Exception: # pylint: disable=W0703 logging.exception("Error while activating disks") @@ -549,7 +549,7 @@ def _StartGroupChildren(cl, wait): try: # TODO: Should utils.StartDaemon be used instead? pid = os.spawnv(os.P_NOWAIT, args[0], args) - except Exception: # pylint: disable-msg=W0703 + except Exception: # pylint: disable=W0703 logging.exception("Failed to start child for group '%s' (%s)", name, uuid) else: @@ -596,8 +596,8 @@ def _GlobalWatcher(opts): # Run node maintenance in all cases, even if master, so that old masters can # be properly cleaned up - if nodemaint.NodeMaintenance.ShouldRun(): # pylint: disable-msg=E0602 - nodemaint.NodeMaintenance().Exec() # pylint: disable-msg=E0602 + if nodemaint.NodeMaintenance.ShouldRun(): # pylint: disable=E0602 + nodemaint.NodeMaintenance().Exec() # pylint: disable=E0602 try: client = GetLuxiClient(True) @@ -729,11 +729,11 @@ def _GroupWatcher(opts): logging.debug("Using state file %s", state_path) # Global watcher - statefile = state.OpenStateFile(state_path) # pylint: disable-msg=E0602 + statefile = state.OpenStateFile(state_path) # pylint: disable=E0602 if not statefile: return constants.EXIT_FAILURE - notepad = state.WatcherState(statefile) # pylint: disable-msg=E0602 + notepad = state.WatcherState(statefile) # pylint: disable=E0602 try: # Connect to master daemon client = GetLuxiClient(False) diff --git a/lib/watcher/nodemaint.py b/lib/watcher/nodemaint.py index a00fc9b19..33be4f13a 100644 --- a/lib/watcher/nodemaint.py +++ b/lib/watcher/nodemaint.py @@ -34,7 +34,7 @@ from ganeti import ssconf from ganeti import utils from ganeti import confd -import ganeti.confd.client # pylint: disable-msg=W0611 +import ganeti.confd.client # pylint: disable=W0611 class NodeMaintenance(object): @@ -70,7 +70,7 @@ class NodeMaintenance(object): hv = hypervisor.GetHypervisor(hv_name) ilist = hv.ListInstances() results.extend([(iname, hv_name) for iname in ilist]) - except: # pylint: disable-msg=W0702 + except: # pylint: disable=W0702 logging.error("Error while listing instances for hypervisor %s", hv_name, exc_info=True) return results @@ -121,7 +121,7 @@ class NodeMaintenance(object): logging.info("Following DRBD minors should not be active," " shutting them down: %s", utils.CommaJoin(drbd_running)) for minor in drbd_running: - # pylint: disable-msg=W0212 + # pylint: disable=W0212 # using the private method as is, pending enhancements to the DRBD # interface bdev.DRBD8._ShutdownAll(minor) diff --git a/lib/watcher/state.py b/lib/watcher/state.py index 34630f499..be52c65b5 100644 --- a/lib/watcher/state.py +++ b/lib/watcher/state.py @@ -86,7 +86,7 @@ class WatcherState(object): self._data = {} else: self._data = serializer.Load(state_data) - except Exception, msg: # pylint: disable-msg=W0703 + except Exception, msg: # pylint: disable=W0703 # Ignore errors while loading the file and treat it as empty self._data = {} logging.warning(("Invalid state file. Using defaults." diff --git a/lib/workerpool.py b/lib/workerpool.py index d276b1837..4736be5e7 100644 --- a/lib/workerpool.py +++ b/lib/workerpool.py @@ -59,7 +59,7 @@ class BaseWorker(threading.Thread, object): Users of a worker pool must override RunTask in a subclass. """ - # pylint: disable-msg=W0212 + # pylint: disable=W0212 def __init__(self, pool, worker_id): """Constructor for BaseWorker thread. @@ -169,7 +169,7 @@ class BaseWorker(threading.Thread, object): logging.debug("Starting task %r, priority %s", args, priority) assert self.getName() == self._worker_id try: - self.RunTask(*args) # pylint: disable-msg=W0142 + self.RunTask(*args) # pylint: disable=W0142 finally: self.SetTaskName(None) logging.debug("Done with task %r, priority %s", args, priority) @@ -184,7 +184,7 @@ class BaseWorker(threading.Thread, object): args, defer.priority) assert self._HasRunningTaskUnlocked() - except: # pylint: disable-msg=W0702 + except: # pylint: disable=W0702 logging.exception("Caught unhandled exception") assert self._HasRunningTaskUnlocked() @@ -384,7 +384,7 @@ class WorkerPool(object): """ for worker in self._workers + self._termworkers: - if worker._HasRunningTaskUnlocked(): # pylint: disable-msg=W0212 + if worker._HasRunningTaskUnlocked(): # pylint: disable=W0212 return True return False diff --git a/qa/ganeti-qa.py b/qa/ganeti-qa.py index 6fa83c727..0cb88ff02 100755 --- a/qa/ganeti-qa.py +++ b/qa/ganeti-qa.py @@ -23,7 +23,7 @@ """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # due to invalid name import sys @@ -46,7 +46,7 @@ from ganeti import utils from ganeti import rapi from ganeti import constants -import ganeti.rapi.client # pylint: disable-msg=W0611 +import ganeti.rapi.client # pylint: disable=W0611 def _FormatHeader(line, end=72): diff --git a/qa/qa_config.py b/qa/qa_config.py index 29c6e6955..b4cff14f9 100644 --- a/qa/qa_config.py +++ b/qa/qa_config.py @@ -39,7 +39,7 @@ def Load(path): """Loads the passed configuration file. """ - global cfg # pylint: disable-msg=W0603 + global cfg # pylint: disable=W0603 cfg = serializer.LoadJson(utils.ReadFile(path)) diff --git a/qa/qa_instance.py b/qa/qa_instance.py index 4747839eb..45ee521fd 100644 --- a/qa/qa_instance.py +++ b/qa/qa_instance.py @@ -251,7 +251,7 @@ def TestInstanceConsole(instance): def TestReplaceDisks(instance, pnode, snode, othernode): """gnt-instance replace-disks""" - # pylint: disable-msg=W0613 + # pylint: disable=W0613 # due to unused pnode arg # FIXME: should be removed from the function completely def buildcmd(args): @@ -429,7 +429,7 @@ def _TestInstanceDiskFailure(instance, node, node2, onmaster): def TestInstanceMasterDiskFailure(instance, node, node2): """Testing disk failure on master node.""" - # pylint: disable-msg=W0613 + # pylint: disable=W0613 # due to unused args print qa_utils.FormatError("Disk failure on primary node cannot be" " tested due to potential crashes.") diff --git a/qa/qa_rapi.py b/qa/qa_rapi.py index 407279efc..ece6e6452 100644 --- a/qa/qa_rapi.py +++ b/qa/qa_rapi.py @@ -35,7 +35,7 @@ from ganeti import query from ganeti import compat from ganeti import qlang -import ganeti.rapi.client # pylint: disable-msg=W0611 +import ganeti.rapi.client # pylint: disable=W0611 import ganeti.rapi.client_utils import qa_config @@ -55,7 +55,7 @@ def Setup(username, password): """Configures the RAPI client. """ - # pylint: disable-msg=W0603 + # pylint: disable=W0603 # due to global usage global _rapi_ca global _rapi_client @@ -122,7 +122,7 @@ def Enabled(): def _DoTests(uris): - # pylint: disable-msg=W0212 + # pylint: disable=W0212 # due to _SendRequest usage results = [] diff --git a/qa/qa_utils.py b/qa/qa_utils.py index 441bc8768..671a6f21a 100644 --- a/qa/qa_utils.py +++ b/qa/qa_utils.py @@ -50,7 +50,7 @@ def _SetupColours(): """Initializes the colour constants. """ - # pylint: disable-msg=W0603 + # pylint: disable=W0603 # due to global usage global _INFO_SEQ, _WARNING_SEQ, _ERROR_SEQ, _RESET_SEQ diff --git a/tools/burnin b/tools/burnin index 8ab7a15f4..c5d1612ff 100755 --- a/tools/burnin +++ b/tools/burnin @@ -91,12 +91,12 @@ def Err(msg, exit_code=1): class SimpleOpener(urllib.FancyURLopener): """A simple url opener""" - # pylint: disable-msg=W0221 + # pylint: disable=W0221 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 + # pylint: disable=W0613 return None, None def http_error_default(self, url, fp, errcode, errmsg, headers): @@ -232,7 +232,7 @@ def _DoCheckInstances(fn): def wrapper(self, *args, **kwargs): val = fn(self, *args, **kwargs) for instance in self.instances: - self._CheckInstanceAlive(instance) # pylint: disable-msg=W0212 + self._CheckInstanceAlive(instance) # pylint: disable=W0212 return val return wrapper @@ -312,7 +312,7 @@ class Burner(object): Log("Idempotent %s succeeded after %d retries", msg, MAX_RETRIES - retry_count) return val - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 if retry_count == 0: Log("Non-idempotent %s failed, aborting", msg) raise @@ -358,7 +358,7 @@ class Burner(object): cli.SetGenericOpcodeOpts(ops, self.opts) self.queued_ops.append((ops, name, post_process)) else: - val = self.ExecOp(self.queue_retry, *ops) # pylint: disable-msg=W0142 + val = self.ExecOp(self.queue_retry, *ops) # pylint: disable=W0142 if post_process is not None: post_process() return val @@ -400,10 +400,10 @@ class Burner(object): self.ClearFeedbackBuf() jex = cli.JobExecutor(cl=self.cl, feedback_fn=self.Feedback) for ops, name, _ in jobs: - jex.QueueJob(name, *ops) # pylint: disable-msg=W0142 + jex.QueueJob(name, *ops) # pylint: disable=W0142 try: results = jex.GetResults() - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 Log("Jobs failed: %s", err) raise BurninFailure() @@ -414,7 +414,7 @@ class Burner(object): if post_process: try: post_process() - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 Log("Post process call for job %s failed: %s", name, err) fail = True val.append(result) @@ -1066,7 +1066,7 @@ class Burner(object): if not self.opts.keep_instances: try: self.BurnRemove() - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 if has_err: # already detected errors, so errors in removal # are quite expected Log("Note: error detected during instance remove: %s", err) diff --git a/tools/cfgshell b/tools/cfgshell index 77afab9dc..3e79561b1 100755 --- a/tools/cfgshell +++ b/tools/cfgshell @@ -24,7 +24,7 @@ """ # functions in this module need to have a given name structure, so: -# pylint: disable-msg=C0103 +# pylint: disable=C0103 import optparse @@ -54,7 +54,7 @@ class ConfigShell(cmd.Cmd): """ # all do_/complete_* functions follow the same API - # pylint: disable-msg=W0613 + # pylint: disable=W0613 prompt = "(/) " def __init__(self, cfg_file=None): @@ -93,7 +93,7 @@ class ConfigShell(cmd.Cmd): dirs = [] entries = [] if isinstance(obj, objects.ConfigObject): - # pylint: disable-msg=W0212 + # pylint: disable=W0212 # yes, we're using a protected member for name in obj._all_slots(): child = getattr(obj, name, None) @@ -156,7 +156,7 @@ class ConfigShell(cmd.Cmd): arg = None try: self.cfg = config.ConfigWriter(cfg_file=arg, offline=True) - self.parents = [self.cfg._config_data] # pylint: disable-msg=W0212 + self.parents = [self.cfg._config_data] # pylint: disable=W0212 self.path = [] except errors.ConfigurationError, err: print "Error: %s" % str(err) @@ -288,7 +288,7 @@ class ConfigShell(cmd.Cmd): if self.cfg.VerifyConfig(): print "Config data does not validate, refusing to save." return False - self.cfg._WriteConfig() # pylint: disable-msg=W0212 + self.cfg._WriteConfig() # pylint: disable=W0212 def do_rm(self, line): """Removes an instance or a node. @@ -298,7 +298,7 @@ class ConfigShell(cmd.Cmd): """ pointer = self.parents[-1] - data = self.cfg._config_data # pylint: disable-msg=W0212 + data = self.cfg._config_data # pylint: disable=W0212 if pointer not in (data.instances, data.nodes): print "Can only delete instances and nodes" return False diff --git a/tools/cfgupgrade b/tools/cfgupgrade index 7197d2484..b44ea6c1f 100755 --- a/tools/cfgupgrade +++ b/tools/cfgupgrade @@ -93,7 +93,7 @@ def main(): """Main program. """ - global options, args # pylint: disable-msg=W0603 + global options, args # pylint: disable=W0603 # Option parsing parser = optparse.OptionParser(usage="%prog [--debug|--verbose] [--force]") diff --git a/tools/cfgupgrade12 b/tools/cfgupgrade12 index 7ff5daa6b..83187c3d7 100755 --- a/tools/cfgupgrade12 +++ b/tools/cfgupgrade12 @@ -18,7 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. -# pylint: disable-msg=C0103,E1103 +# pylint: disable=C0103,E1103 # C0103: invalid name NoDefault # E1103: Instance of 'foor' has no 'bar' member (but some types could @@ -281,7 +281,7 @@ def main(): """Main program. """ - # pylint: disable-msg=W0603 + # pylint: disable=W0603 global options, args program = os.path.basename(sys.argv[0]) diff --git a/tools/check-cert-expired b/tools/check-cert-expired index f47ca9849..32580bd50 100755 --- a/tools/check-cert-expired +++ b/tools/check-cert-expired @@ -22,7 +22,7 @@ """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # C0103: Invalid name check-cert-expired import os.path @@ -66,7 +66,7 @@ def main(): except (KeyboardInterrupt, SystemExit): raise - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 cli.ToStderr("Unable to check %s: %s", filename, err) sys.exit(constants.EXIT_FAILURE) diff --git a/tools/cluster-merge b/tools/cluster-merge index e2fc8485b..40bc2596b 100755 --- a/tools/cluster-merge +++ b/tools/cluster-merge @@ -24,7 +24,7 @@ The clusters have to run the same version of Ganeti! """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # C0103: Invalid name cluster-merge import logging @@ -374,7 +374,7 @@ class Merger(object): utils.WriteFile(data.config_path, data=result.stdout) # R0201: Method could be a function - def _KillMasterDaemon(self): # pylint: disable-msg=R0201 + def _KillMasterDaemon(self): # pylint: disable=R0201 """Kills the local master daemon. @raise errors.CommandError: If unable to kill @@ -574,7 +574,7 @@ class Merger(object): other_cluster.cluster_name) # R0201: Method could be a function - def _GetOsHypervisor(self, cluster, os_name, hyp): # pylint: disable-msg=R0201 + def _GetOsHypervisor(self, cluster, os_name, hyp): # pylint: disable=R0201 if os_name in cluster.os_hvp: return cluster.os_hvp[os_name].get(hyp, None) else: @@ -586,7 +586,7 @@ class Merger(object): ConfigWriter.AddNodeGroup takes care of making sure there are no conflicts. """ - # pylint: disable-msg=R0201 + # pylint: disable=R0201 logging.info("Node group conflict strategy: %s", self.groups) my_grps = my_config.GetAllNodeGroupsInfo().values() @@ -626,15 +626,15 @@ class Merger(object): for node_name in other_grp.members[:]: node = other_config.GetNodeInfo(node_name) # Access to a protected member of a client class - # pylint: disable-msg=W0212 + # pylint: disable=W0212 other_config._UnlockedRemoveNodeFromGroup(node) # Access to a protected member of a client class - # pylint: disable-msg=W0212 + # pylint: disable=W0212 my_grp_uuid = my_config._UnlockedLookupNodeGroup(other_grp.name) # Access to a protected member of a client class - # pylint: disable-msg=W0212 + # pylint: disable=W0212 my_config._UnlockedAddNodeToGroup(node, my_grp_uuid) node.group = my_grp_uuid # Remove from list of groups to add @@ -645,7 +645,7 @@ class Merger(object): my_config.AddNodeGroup(grp, _CLUSTERMERGE_ECID) # R0201: Method could be a function - def _StartMasterDaemon(self, no_vote=False): # pylint: disable-msg=R0201 + def _StartMasterDaemon(self, no_vote=False): # pylint: disable=R0201 """Starts the local master daemon. @param no_vote: Should the masterd started without voting? default: False @@ -683,7 +683,7 @@ class Merger(object): result.output)) # R0201: Method could be a function - def _StartupAllInstances(self): # pylint: disable-msg=R0201 + def _StartupAllInstances(self): # pylint: disable=R0201 """Starts up all instances (locally). @raise errors.CommandError: If unable to start clusters @@ -698,7 +698,7 @@ class Merger(object): # R0201: Method could be a function # TODO: make this overridable, for some verify errors - def _VerifyCluster(self): # pylint: disable-msg=R0201 + def _VerifyCluster(self): # pylint: disable=R0201 """Runs gnt-cluster verify to verify the health. @raise errors.ProgrammError: If cluster fails on verification diff --git a/tools/ganeti-listrunner b/tools/ganeti-listrunner index 3194f866b..392c68819 100755 --- a/tools/ganeti-listrunner +++ b/tools/ganeti-listrunner @@ -49,7 +49,7 @@ Security considerations: """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # C0103: Invalid name ganeti-listrunner import errno @@ -231,7 +231,7 @@ def SetupSshConnection(host, username, password, use_agent, logfile): log = logging.getLogger(transport.get_log_channel()) log.addHandler(handler) - transport.connect(username=username, **kwargs) # pylint: disable-msg=W0142 + transport.connect(username=username, **kwargs) # pylint: disable=W0142 WriteLog("ssh connection established using %s" % desc, logfile) # strange ... when establishing the session and the immediately # setting up the channels for sftp & shell from that, it sometimes diff --git a/tools/lvmstrap b/tools/lvmstrap index e24b2a6da..eb87cd232 100755 --- a/tools/lvmstrap +++ b/tools/lvmstrap @@ -170,7 +170,7 @@ def ParseOptions(): OptionParser.parse_args """ - global verbose_flag # pylint: disable-msg=W0603 + global verbose_flag # pylint: disable=W0603 parser = optparse.OptionParser(usage="\n%s" % USAGE, version="%%prog (ganeti) %s" % diff --git a/tools/move-instance b/tools/move-instance index cdf99ec97..168ad811f 100755 --- a/tools/move-instance +++ b/tools/move-instance @@ -22,7 +22,7 @@ """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # C0103: Invalid name move-instance import os @@ -40,7 +40,7 @@ from ganeti import objects from ganeti import compat from ganeti import rapi -import ganeti.rapi.client # pylint: disable-msg=W0611 +import ganeti.rapi.client # pylint: disable=W0611 import ganeti.rapi.client_utils @@ -662,7 +662,7 @@ class MoveSourceExecutor(object): class MoveSourceWorker(workerpool.BaseWorker): - def RunTask(self, rapi_factory, move): # pylint: disable-msg=W0221 + def RunTask(self, rapi_factory, move): # pylint: disable=W0221 """Executes an instance move. @type rapi_factory: L{RapiClientFactory} @@ -696,7 +696,7 @@ class MoveSourceWorker(workerpool.BaseWorker): (mrt.src_error_message, mrt.dest_error_message)) else: move.error_message = None - except Exception, err: # pylint: disable-msg=W0703 + except Exception, err: # pylint: disable=W0703 logging.exception("Caught unhandled exception") move.error_message = str(err) diff --git a/tools/sanitize-config b/tools/sanitize-config index ca9c95539..f94e67084 100755 --- a/tools/sanitize-config +++ b/tools/sanitize-config @@ -19,7 +19,7 @@ # 02110-1301, USA. -# pylint: disable-msg=C0103 +# pylint: disable=C0103 """Tool to sanitize/randomize the configuration file. @@ -79,7 +79,7 @@ def GenerateNameMap(opts, names, base): return name_map -def SanitizeSecrets(opts, cfg): # pylint: disable-msg=W0613 +def SanitizeSecrets(opts, cfg): # pylint: disable=W0613 """Cleanup configuration secrets. """ @@ -126,7 +126,7 @@ def SanitizeInstances(opts, cfg): RenameDictKeys(cfg["instances"], old_map, True) -def SanitizeIps(opts, cfg): # pylint: disable-msg=W0613 +def SanitizeIps(opts, cfg): # pylint: disable=W0613 """Sanitize the IP names. @note: we're interested in obscuring the old IPs, not in generating @@ -161,7 +161,7 @@ def SanitizeIps(opts, cfg): # pylint: disable-msg=W0613 nic["ip"] = _Get(nic["ip"]) -def SanitizeOsNames(opts, cfg): # pylint: disable-msg=W0613 +def SanitizeOsNames(opts, cfg): # pylint: disable=W0613 """Sanitize the OS names. """ @@ -182,7 +182,7 @@ def SanitizeOsNames(opts, cfg): # pylint: disable-msg=W0613 RenameDictKeys(cfg["cluster"]["os_hvp"], os_map, False) -def SanitizeDisks(opts, cfg): # pylint: disable-msg=W0613 +def SanitizeDisks(opts, cfg): # pylint: disable=W0613 """Cleanup disks disks. """ diff --git a/tools/setup-ssh b/tools/setup-ssh index 112caf61b..8c406ce93 100755 --- a/tools/setup-ssh +++ b/tools/setup-ssh @@ -24,7 +24,7 @@ This is needed before we can join the node into the cluster. """ -# pylint: disable-msg=C0103 +# pylint: disable=C0103 # C0103: Invalid name setup-ssh import getpass -- GitLab