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