Commit fe267188 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add targetted pylint disables



This patch adds targeted pylint disables, where it makes sense (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”.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarOlivier Tharan <olive@google.com>
parent caeffaa0
......@@ -20,3 +20,5 @@
# empty file for package definition
"""Ganeti python modules"""
......@@ -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):
......
......@@ -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
......
......@@ -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:
......
......@@ -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.
......
......@@ -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:
......
......@@ -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:
......
......@@ -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
......
......@@ -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):
......
......@@ -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:
......
......@@ -23,6 +23,10 @@
"""
# pylint: disable-msg=C0103
# C0103: Invalid name, since the R_* names are not conforming
import logging
from ganeti import luxi
......
......@@ -22,6 +22,10 @@
"""
# pylint: disable-msg=C0103
# C0103: Invalid name, since the R_* names are not conforming
import cgi
import re
......
......@@ -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",
......
......@@ -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()
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment