Commit 876fb142 authored by Helga Velroyen's avatar Helga Velroyen

Convert all the classes to new-style classes

... to make lint shut up.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarJose Lopes <jabolopes@google.com>
parent c4460a46
......@@ -252,7 +252,7 @@ def WriteCompReply(sw, args, cur="\"$cur\""):
sw.Write("return")
class CompletionWriter:
class CompletionWriter(object):
"""Command completion writer class.
"""
......
......@@ -99,7 +99,7 @@ def SetupLogging():
return child_logger
class StatusFile:
class StatusFile(object):
"""Status file manager.
"""
......
......@@ -1722,7 +1722,7 @@ def InstanceShutdown(instance, timeout, reason, store_reason=True):
logging.info("Instance %s not running, doing nothing", iname)
return
class _TryShutdown:
class _TryShutdown(object):
def __init__(self):
self.tried_once = False
......
......@@ -345,7 +345,7 @@ _QFT_NAMES = {
}
class _Argument:
class _Argument(object):
def __init__(self, min=0, max=None): # pylint: disable=W0622
self.min = min
self.max = max
......@@ -2108,7 +2108,7 @@ def GenericPollJob(job_id, cbs, report_cbs):
raise errors.OpExecError(result)
class JobPollCbBase:
class JobPollCbBase(object):
"""Base class for L{GenericPollJob} callbacks.
"""
......@@ -2136,7 +2136,7 @@ class JobPollCbBase:
raise NotImplementedError()
class JobPollReportCbBase:
class JobPollReportCbBase(object):
"""Base class for L{GenericPollJob} reporting callbacks.
"""
......@@ -2790,7 +2790,7 @@ def GenericInstanceCreate(mode, opts, args):
return 0
class _RunWhileClusterStoppedHelper:
class _RunWhileClusterStoppedHelper(object):
"""Helper class for L{RunWhileClusterStopped} to simplify state management
"""
......@@ -3073,7 +3073,7 @@ def _GetColumnFormatter(fdef, override, unit):
raise NotImplementedError("Can't format column type '%s'" % fdef.kind)
class _QueryColumnFormatter:
class _QueryColumnFormatter(object):
"""Callable class for formatting fields of a query.
"""
......@@ -3347,7 +3347,7 @@ def GenericListFields(resource, fields, separator, header, cl=None):
return constants.EXIT_SUCCESS
class TableColumn:
class TableColumn(object):
"""Describes a column for L{FormatTable}.
"""
......
......@@ -1369,7 +1369,7 @@ def _InstanceStart(opts, inst_list, start, no_remember=False):
return True
class _RunWhenNodesReachableHelper:
class _RunWhenNodesReachableHelper(object):
"""Helper class to make shared internal state sharing easier.
@ivar success: Indicates if all action_cb calls were successful
......
......@@ -31,7 +31,7 @@ from ganeti import utils
from ganeti.cmdlib.common import ExpandInstanceUuidAndName
class ResultWithJobs:
class ResultWithJobs(object):
"""Data container for LU results with jobs.
Instances of this class returned from L{LogicalUnit.Exec} will be recognized
......@@ -426,7 +426,7 @@ class NoHooksLU(LogicalUnit): # pylint: disable=W0223
raise AssertionError("PreparePostHookNodes called for NoHooksLU")
class Tasklet:
class Tasklet(object):
"""Tasklet base class.
Tasklets are subcomponents for LUs. LUs can consist entirely of tasklets or
......@@ -472,7 +472,7 @@ class Tasklet:
raise NotImplementedError
class QueryBase:
class QueryBase(object):
"""Base for query utility classes.
"""
......
......@@ -2095,7 +2095,7 @@ class LUInstanceMultiAlloc(NoHooksLU):
return ResultWithJobs(jobs, **self._ConstructPartialResult())
class _InstNicModPrivate:
class _InstNicModPrivate(object):
"""Data structure for network interface modifications.
Used by L{LUInstanceSetParams}.
......
......@@ -106,7 +106,7 @@ class _Request(object):
self.rcvd = set()
class ConfdClient:
class ConfdClient(object):
"""Send queries to confd, and get back answers.
Since the confd model works by querying multiple master candidates, and
......@@ -462,7 +462,7 @@ class ConfdClientRequest(objects.ConfdRequest):
raise errors.ConfdClientError("Invalid request type")
class ConfdFilterCallback:
class ConfdFilterCallback(object):
"""Callback that calls another callback, but filters duplicate results.
@ivar consistent: a dictionary indexed by salt; for each salt, if
......@@ -567,7 +567,7 @@ class ConfdFilterCallback:
self._callback(up)
class ConfdCountingCallback:
class ConfdCountingCallback(object):
"""Callback that calls another callback, and counts the answers
"""
......@@ -629,7 +629,7 @@ class ConfdCountingCallback:
self._callback(up)
class StoreResultCallback:
class StoreResultCallback(object):
"""Callback that simply stores the most recent answer.
@ivar _answers: dict of salt to (have_answer, reply)
......
......@@ -75,7 +75,7 @@ def _ValidateConfig(data):
data['version'])
class TemporaryReservationManager:
class TemporaryReservationManager(object):
"""A temporary resource reservation manager.
This is used to reserve resources in a job, before using them, making sure
......
......@@ -457,7 +457,7 @@ class AsyncAwaker(GanetiBaseAsyncoreDispatcher):
self.out_socket.send(chr(0))
class _ShutdownCheck:
class _ShutdownCheck(object):
"""Logic for L{Mainloop} shutdown.
"""
......
......@@ -174,7 +174,7 @@ def _StartRequest(curl, req):
return _PendingRequest(curl, req, resp_buffer.getvalue)
class _PendingRequest:
class _PendingRequest(object):
def __init__(self, curl, req, resp_buffer_read):
"""Initializes this class.
......@@ -233,7 +233,7 @@ class _PendingRequest:
req.completion_cb(req)
class _NoOpRequestMonitor: # pylint: disable=W0232
class _NoOpRequestMonitor(object): # pylint: disable=W0232
"""No-op request monitor.
"""
......@@ -245,7 +245,7 @@ class _NoOpRequestMonitor: # pylint: disable=W0232
Disable = acquire
class _PendingRequestMonitor:
class _PendingRequestMonitor(object):
_LOCK = "_lock"
def __init__(self, owner, pending_fn):
......
......@@ -546,6 +546,7 @@ class _QueuedJob(object):
class _OpExecCallbacks(mcpu.OpExecCbBase):
def __init__(self, queue, job, op):
"""Initializes this class.
......@@ -557,6 +558,8 @@ class _OpExecCallbacks(mcpu.OpExecCbBase):
@param op: OpCode
"""
super(_OpExecCallbacks, self).__init__()
assert queue, "Queue is missing"
assert job, "Job is missing"
assert op, "Opcode is missing"
......
......@@ -969,7 +969,7 @@ class _AcquireTimeout(Exception):
"""
class LockSet:
class LockSet(object):
"""Implements a set of locks.
This abstraction implements a set of shared locks for the same resource type,
......
......@@ -659,7 +659,7 @@ def FormatProgress(progress):
return utils.CommaJoin(parts)
class ImportExportLoop:
class ImportExportLoop(object):
MIN_DELAY = 1.0
MAX_DELAY = 20.0
......@@ -1140,7 +1140,7 @@ class _RemoteExportCb(ImportExportCbBase):
finished_fn()
class ExportInstanceHelper:
class ExportInstanceHelper(object):
def __init__(self, lu, feedback_fn, instance):
"""Initializes this class.
......
......@@ -139,7 +139,7 @@ class LockAttemptTimeoutStrategy(object):
return timeout
class OpExecCbBase: # pylint: disable=W0232
class OpExecCbBase(object): # pylint: disable=W0232
"""Base class for OpCode execution callbacks.
"""
......
......@@ -157,7 +157,7 @@ def GetHostname(name=None, family=None):
(err[0], err[2]), errors.ECODE_RESOLVER)
class Hostname:
class Hostname(object):
"""Class implementing resolver and hostname functionality.
"""
......
......@@ -201,7 +201,7 @@ def GetAllFields(fielddefs):
return [fdef for (fdef, _, _, _) in fielddefs]
class _FilterHints:
class _FilterHints(object):
"""Class for filter analytics.
When filters are used, the user of the L{Query} class usually doesn't know
......@@ -387,7 +387,7 @@ def _MakeComparisonChecks(fn):
]
class _FilterCompilerHelper:
class _FilterCompilerHelper(object):
"""Converts a query filter to a callable usable for filtering.
"""
......@@ -655,7 +655,7 @@ def _CompileFilter(fields, hints, qfilter):
return _FilterCompilerHelper(fields)(hints, qfilter)
class Query:
class Query(object):
def __init__(self, fieldlist, selected, qfilter=None, namefield=None):
"""Initializes this class.
......@@ -1087,7 +1087,7 @@ def _GetItemTimestampFields(datatype):
]
class NodeQueryData:
class NodeQueryData(object):
"""Data container for node data queries.
"""
......@@ -1406,7 +1406,7 @@ def _BuildNodeFields():
return _PrepareFieldList(fields, [])
class InstanceQueryData:
class InstanceQueryData(object):
"""Data container for instance data queries.
"""
......@@ -2236,7 +2236,7 @@ def _BuildInstanceFields():
return _PrepareFieldList(fields, aliases)
class LockQueryData:
class LockQueryData(object):
"""Data container for lock data queries.
"""
......@@ -2298,7 +2298,7 @@ def _BuildLockFields():
], [])
class GroupQueryData:
class GroupQueryData(object):
"""Data container for node group data queries.
"""
......@@ -2658,7 +2658,7 @@ _CLUSTER_SIMPLE_FIELDS = {
}
class ClusterQueryData:
class ClusterQueryData(object):
def __init__(self, cluster, nodes, drain_flag, watcher_pause):
"""Initializes this class.
......@@ -2730,7 +2730,7 @@ def _BuildClusterFields():
("name", "cluster_name")])
class NetworkQueryData:
class NetworkQueryData(object):
"""Data container for network data queries.
"""
......
......@@ -43,7 +43,7 @@ _DISK_PATTERN = r"\d+"
CONNECTOR = {}
class Mapper:
class Mapper(object):
"""Map resource to method.
"""
......
......@@ -145,7 +145,7 @@ def _FormatHeaders(headers):
return "\n".join(headers)
class FakeCurl:
class FakeCurl(object):
"""Fake cURL object.
"""
......@@ -206,7 +206,7 @@ class FakeCurl:
writefn(resp_body)
class _RapiMock:
class _RapiMock(object):
"""Mocking out the RAPI server parts.
"""
......@@ -249,7 +249,7 @@ class _RapiMock:
return (resp_msg.start_line.code, resp_msg.headers, resp_msg.body)
class _TestLuxiTransport:
class _TestLuxiTransport(object):
"""Mocked LUXI transport.
Raises L{errors.RapiTestResult} for all method calls, no matter the
......@@ -282,7 +282,7 @@ class _TestLuxiTransport:
raise errors.RapiTestResult
class _LuxiCallRecorder:
class _LuxiCallRecorder(object):
"""Records all called LUXI client methods.
"""
......@@ -327,7 +327,7 @@ def _TestWrapper(fn, *args, **kwargs):
return NotImplemented
class InputTestClient:
class InputTestClient(object):
"""Test version of RAPI client.
Instances of this class can be used to test input arguments for RAPI client
......
......@@ -68,7 +68,7 @@ def GetGid(group, _getgrnam):
raise errors.ConfigurationError("Group '%s' not found (%s)" % (group, err))
class GetentResolver:
class GetentResolver(object):
"""Resolves Ganeti uids and gids by name.
@ivar masterd_uid: The resolved uid of the masterd user
......
......@@ -143,7 +143,7 @@ class MasterClientHandler(daemon.AsyncTerminatedMessageStream):
self.server.request_workers.AddTask((self.server, message, self))
class _MasterShutdownCheck:
class _MasterShutdownCheck(object):
"""Logic for master daemon shutdown.
"""
......@@ -267,7 +267,7 @@ class MasterServer(daemon.AsyncStreamServer):
self.context.jobqueue.Shutdown()
class ClientOps:
class ClientOps(object):
"""Class holding high-level client operations."""
def __init__(self, server):
self.server = server
......
......@@ -205,7 +205,7 @@ class RemoteApiHandler(http.auth.HttpServerRequestAuthentication,
return serializer.DumpJson(result)
class RapiUsers:
class RapiUsers(object):
def __init__(self):
"""Initializes this class.
......
......@@ -106,7 +106,7 @@ def GetAllUserFiles(user, mkdir=False, dircheck=True, _homedir_fn=None):
for (kind, (privkey, pubkey, _)) in result))
class SshRunner:
class SshRunner(object):
"""Wrapper for SSH commands.
"""
......
......@@ -43,7 +43,7 @@ def _ParseSize(value):
return int(round(float(value), 0))
class _Base:
class _Base(object):
"""Base class for storage abstraction.
"""
......@@ -95,6 +95,8 @@ class FileStorage(_Base): # pylint: disable=W0223
@param paths: List of file storage paths
"""
super(FileStorage, self).__init__()
self._paths = paths
def List(self, name, fields):
......
......@@ -711,7 +711,7 @@ class DRBD8Dev(base.BlockDev):
base.ThrowError("drbd%d: DRBD disk missing network info in"
" DisconnectNet()", self.minor)
class _DisconnectStatus:
class _DisconnectStatus(object):
def __init__(self, ever_disconnected):
self.ever_disconnected = ever_disconnected
......
......@@ -71,7 +71,7 @@ def ErrnoOrStr(err):
return detail
class FileStatHelper:
class FileStatHelper(object):
"""Helper to store file handle's C{fstat}.
Useful in combination with L{ReadFile}'s C{preread} parameter.
......
......@@ -246,7 +246,7 @@ def ShellCombineCommands(cmdlist):
return ["/bin/sh", "-c", " && ".join(ShellQuoteArgs(c) for c in cmdlist)]
class ShellWriter:
class ShellWriter(object):
"""Helper class to write scripts with indentation.
"""
......@@ -530,7 +530,7 @@ def FormatSeconds(secs):
return " ".join(parts)
class LineSplitter:
class LineSplitter(object):
"""Splits data chunks into lines separated by newline.
Instances provide a file-like interface.
......
......@@ -158,7 +158,7 @@ class Instance(object):
cli.SubmitOpCode(op, cl=cl)
class Node:
class Node(object):
"""Data container representing cluster node.
"""
......
......@@ -666,7 +666,7 @@ def get(name, default=None):
return GetConfig().get(name, default=default)
class Either:
class Either(object):
def __init__(self, tests):
"""Initializes this class.
......
......@@ -33,6 +33,8 @@ class LogRecordingCallback(mcpu.OpExecCbBase):
"""
def __init__(self, processor):
super(LogRecordingCallback, self).__init__()
self.processor = processor
def Feedback(self, *args):
......
......@@ -54,7 +54,7 @@ def ParseOptions():
return (opts, args)
class State:
class State(object):
def __init__(self, thread_count):
"""Initializes this class.
......
......@@ -104,7 +104,7 @@ class FakeContext(object):
self.glm = FakeGLM()
class FakeGetentResolver:
class FakeGetentResolver(object):
"""Fake runtime.GetentResolver"""
def __init__(self):
......
......@@ -133,7 +133,7 @@ class Abort(Error):
"""
class RapiClientFactory:
class RapiClientFactory(object):
"""Factory class for creating RAPI clients.
@ivar src_cluster_name: Source cluster name
......
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