This patch adds targeted pylint disables, where it makes sues (either
due to limitations in pylint or due to historical usage), and also a few
blanket ones in rapi where all the names are… “different”.
---
lib/__init__.py | 2 ++
lib/backend.py | 6 +++++-
lib/bdev.py | 2 +-
lib/cli.py | 8 ++++----
lib/cmdlib.py | 8 ++++----
lib/http/client.py | 2 +-
lib/jstore.py | 7 ++++---
lib/locking.py | 4 ++--
lib/mcpu.py | 2 +-
lib/objects.py | 2 ++
lib/rapi/baserlib.py | 4 ++++
lib/rapi/connector.py | 4 ++++
lib/rapi/rlib2.py | 5 ++++-
lib/rpc.py | 7 ++++---
lib/serializer.py | 4 ++++
15 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/lib/__init__.py b/lib/__init__.py
index bab6818..b7fb973 100644
--- a/lib/__init__.py
+++ b/lib/__init__.py
@@ -20,3 +20,5 @@
# empty file for package definition
+
+"""Ganeti python modules"""
diff --git a/lib/backend.py b/lib/backend.py
index 30984b3..588413f 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -1151,6 +1151,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
crdev.Open()
except errors.BlockDeviceError, err:
errmsg = "Can't make child '%s' read-write: %s" % (child, err)
@@ -1297,6 +1298,7 @@ def BlockdevAssemble(disk, owner, as_primary):
try:
result = _RecursiveAssembleBD(disk, owner, as_primary)
if isinstance(result, bdev.BlockDev):
+ # pylint: disable-msg=E1103
result = result.dev_path
except errors.BlockDeviceError, err:
result = "Error while assembling disk: %s" % str(err)
@@ -2510,7 +2512,9 @@ class HooksRunner(object):
"""
if hooks_base_dir is None:
hooks_base_dir = constants.HOOKS_BASE_DIR
- self._BASE_DIR = 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
@staticmethod
def ExecHook(script, env):
diff --git a/lib/bdev.py b/lib/bdev.py
index 131fbcf..e3a067c 100644
--- a/lib/bdev.py
+++ b/lib/bdev.py
@@ -720,7 +720,7 @@ class DRBD8Status(object):
self.est_time = None
-class BaseDRBD(BlockDev):
+class BaseDRBD(BlockDev): # pylint: disable-msg=W0223
"""Base DRBD class.
This class contains a few bits of common functionality between the
diff --git a/lib/cli.py b/lib/cli.py
index 95f3cc9..2185dfb 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -198,12 +198,12 @@ SYNC_OPT = make_option("--sync", dest="do_locking",
" in order to ensure more consistent results")
-def ARGS_FIXED(val):
+def ARGS_FIXED(val): # pylint: disable-msg=C0103
"""Macro-like function denoting a fixed number of arguments"""
return -val
-def ARGS_ATLEAST(val):
+def ARGS_ATLEAST(val): # pylint: disable-msg=C0103
"""Macro-like function denoting a minimum number of arguments"""
return val
@@ -797,8 +797,8 @@ def GenerateTable(headers, fields, separator, data,
if unitfields is None:
unitfields = []
- numfields = utils.FieldSet(*numfields)
- unitfields = utils.FieldSet(*unitfields)
+ numfields = utils.FieldSet(*numfields) # pylint: disable-msg=W0142
+ unitfields = utils.FieldSet(*unitfields) # pylint: disable-msg=W0142
format_fields = []
for field in fields:
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 87ce76d..ed87967 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -84,8 +84,8 @@ class LogicalUnit(object):
self.recalculate_locks = {}
self.__ssh = None
# logging
- self.LogWarning = processor.LogWarning
- self.LogInfo = processor.LogInfo
+ self.LogWarning = processor.LogWarning # pylint: disable-msg=C0103
+ self.LogInfo = processor.LogInfo # pylint: disable-msg=C0103
for attr_name in self._OP_REQP:
attr_val = getattr(op, attr_name, None)
@@ -322,7 +322,7 @@ class LogicalUnit(object):
del self.recalculate_locks[locking.LEVEL_NODE]
-class NoHooksLU(LogicalUnit):
+class NoHooksLU(LogicalUnit): # pylint: disable-msg=W0223
"""Simple LU which runs no hooks.
This LU is intended as a parent for other LogicalUnits which will
@@ -6635,7 +6635,7 @@ class LURemoveExport(NoHooksLU):
" Domain Name.")
-class TagsLU(NoHooksLU):
+class TagsLU(NoHooksLU): # pylint: disable-msg=W0223
"""Generic tags LU.
This is an abstract class which is the parent of all the other tags LUs.
diff --git a/lib/http/client.py b/lib/http/client.py
index 717581f..766354a 100644
--- a/lib/http/client.py
+++ b/lib/http/client.py
@@ -254,7 +254,7 @@ class HttpClientRequestExecutor(http.HttpBase):
# Do the secret SSL handshake
if self.using_ssl:
- self.sock.set_connect_state()
+ self.sock.set_connect_state() # pylint: disable-msg=E1103
try:
http.Handshake(self.sock, self.WRITE_TIMEOUT)
except http.HttpSessionHandshakeUnexpectedEOF:
diff --git a/lib/jstore.py b/lib/jstore.py
index 5c59968..723cda1 100644
--- a/lib/jstore.py
+++ b/lib/jstore.py
@@ -130,11 +130,12 @@ def InitAndVerifyQueue(must_lock):
if serial is None:
# There must be a serious problem
- raise errors.JobQueueError("Can't read/parse the job queue serial
file")
+ raise errors.JobQueueError("Can't read/parse the job queue"
+ " serial file")
if not must_lock:
- # There's no need for more error handling. Closing the lock file below
in
- # case of an error will unlock it anyway.
+ # There's no need for more error handling. Closing the lock
+ # file below in case of an error will unlock it anyway.
queue_lock.Unlock()
except:
diff --git a/lib/locking.py b/lib/locking.py
index d24abdf..874b7c0 100644
--- a/lib/locking.py
+++ b/lib/locking.py
@@ -753,7 +753,7 @@ class GanetiLockManager:
# the test cases.
return utils.any((self._is_owned(l) for l in LEVELS[level + 1:]))
- def _BGL_owned(self):
+ def _BGL_owned(self): # pylint: disable-msg=C0103
"""Check if the current thread owns the BGL.
Both an exclusive or a shared acquisition work.
@@ -761,7 +761,7 @@ class GanetiLockManager:
"""
return BGL in self.__keyring[LEVEL_CLUSTER]._list_owned()
- def _contains_BGL(self, level, names):
+ def _contains_BGL(self, level, names): # pylint: disable-msg=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/mcpu.py b/lib/mcpu.py
index 959a837..4a5dbd5 100644
--- a/lib/mcpu.py
+++ b/lib/mcpu.py
@@ -100,7 +100,7 @@ class Processor(object):
"""
self.context = context
self._feedback_fn = None
- self.exclusive_BGL = False
+ self.exclusive_BGL = False # pylint: disable-msg=C0103
self.rpc = rpc.RpcRunner(context.cfg)
def _ExecLU(self, lu):
diff --git a/lib/objects.py b/lib/objects.py
index 43cea75..3952891 100644
--- a/lib/objects.py
+++ b/lib/objects.py
@@ -786,6 +786,8 @@ class Cluster(TaggableObject):
"""Fill defaults for missing configuration values.
"""
+ # pylint: disable-msg=E0203
+ # because these are "defined" via slots, not manually
if self.hvparams is None:
self.hvparams = constants.HVC_DEFAULTS
else:
diff --git a/lib/rapi/baserlib.py b/lib/rapi/baserlib.py
index 77a7e62..3b195ed 100644
--- a/lib/rapi/baserlib.py
+++ b/lib/rapi/baserlib.py
@@ -23,6 +23,10 @@
"""
+# pylint: disable-msg=C0103
+
+# C0103: Invalid name, since the R_* names are not conforming
+
import logging
from ganeti import luxi
diff --git a/lib/rapi/connector.py b/lib/rapi/connector.py
index c6270ab..91ce12f 100644
--- a/lib/rapi/connector.py
+++ b/lib/rapi/connector.py
@@ -22,6 +22,10 @@
"""
+# pylint: disable-msg=C0103
+
+# C0103: Invalid name, since the R_* names are not conforming
+
import cgi
import re
diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py
index 96671ec..f99959d 100644
--- a/lib/rapi/rlib2.py
+++ b/lib/rapi/rlib2.py
@@ -23,6 +23,10 @@
"""
+# pylint: disable-msg=C0103
+
+# C0103: Invalid name, since the R_* names are not conforming
+
from ganeti import opcodes
from ganeti import http
from ganeti import constants
@@ -30,7 +34,6 @@ from ganeti import cli
from ganeti.rapi import baserlib
-
I_FIELDS = ["name", "admin_state", "os",
"pnode", "snodes",
"disk_template",
diff --git a/lib/rpc.py b/lib/rpc.py
index e138859..b1054ca 100644
--- a/lib/rpc.py
+++ b/lib/rpc.py
@@ -42,7 +42,8 @@ from ganeti import serializer
from ganeti import constants
from ganeti import errors
-import ganeti.http.client
+# pylint has a bug here, doesn't see this import
+import ganeti.http.client # pylint: disable-msg=W0611
# Module level variable
@@ -55,7 +56,7 @@ def Init():
Must be called before using any RPC function.
"""
- global _http_manager
+ global _http_manager # pylint: disable-msg=W0603
assert not _http_manager, "RPC module initialized more than once"
@@ -68,7 +69,7 @@ def Shutdown():
Must be called before quitting the program.
"""
- global _http_manager
+ global _http_manager # pylint: disable-msg=W0603
if _http_manager:
_http_manager.Shutdown()
diff --git a/lib/serializer.py b/lib/serializer.py
index fcde992..a5a9ca4 100644
--- a/lib/serializer.py
+++ b/lib/serializer.py
@@ -24,6 +24,10 @@ This module introduces a simple abstraction over the
serialization
backend (currently json).
"""
+# pylint: disable-msg=C0103
+
+# C0103: Invalid name, since pylint doesn't see that Dump points to a
+# function and not a constant
import simplejson
import re
--
1.6.5.7