Revision 7260cfbe

b/daemons/ganeti-confd
26 26

  
27 27
"""
28 28

  
29
# pylint: disable-msg=C0103
30
# C0103: Invalid name ganeti-confd
31

  
29 32
import os
30 33
import sys
31 34
import logging
32 35
import time
33 36

  
34 37
try:
38
  # pylint: disable-msg=E0611
35 39
  from pyinotify import pyinotify
36 40
except ImportError:
37 41
  import pyinotify
......
102 106
    # no need to call the parent's constructor
103 107
    self.watch_manager = watch_manager
104 108
    self.callback = callback
109
    # pylint: disable-msg=E1103
110
    # pylint for some reason doesn't see the below constants
105 111
    self.mask = pyinotify.EventsCodes.IN_IGNORED | \
106 112
                pyinotify.EventsCodes.IN_MODIFY
107 113
    self.file = filename
b/daemons/ganeti-masterd
26 26

  
27 27
"""
28 28

  
29
# pylint: disable-msg=C0103
30
# C0103: Invalid name ganeti-masterd
29 31

  
30 32
import os
31 33
import sys
......
61 63

  
62 64

  
63 65
class ClientRequestWorker(workerpool.BaseWorker):
66
   # pylint: disable-msg=W0221
64 67
  def RunTask(self, server, request, client_address):
65 68
    """Process the request.
66 69

  
......
70 73
    try:
71 74
      server.finish_request(request, client_address)
72 75
      server.close_request(request)
73
    except:
76
    except: # pylint: disable-msg=W0702
74 77
      server.handle_error(request, client_address)
75 78
      server.close_request(request)
76 79

  
......
108 111
    self.request_workers.AddTask(self, request, client_address)
109 112

  
110 113
  @utils.SignalHandled([signal.SIGINT, signal.SIGTERM])
111
  def serve_forever(self, signal_handlers=None):
114
  def serve_forever(self, signal_handlers=None): # pylint: disable-msg=W0221
112 115
    """Handle one request at a time until told to quit."""
113 116
    assert isinstance(signal_handlers, dict) and \
114 117
           len(signal_handlers) > 0, \
......
141 144
  READ_SIZE = 4096
142 145

  
143 146
  def setup(self):
147
    # pylint: disable-msg=W0201
148
    # setup() is the api for initialising for this class
144 149
    self._buffer = ""
145 150
    self._msgs = collections.deque()
146 151
    self._ops = ClientOps(self.server)
......
204 209
  def __init__(self, server):
205 210
    self.server = server
206 211

  
207
  def handle_request(self, method, args):
212
  def handle_request(self, method, args): # pylint: disable-msg=R0911
208 213
    queue = self.server.context.jobqueue
209 214

  
210 215
    # TODO: Parameter validation
211 216

  
217
    # TODO: Rewrite to not exit in each 'if/elif' branch
218

  
212 219
    if method == luxi.REQ_SUBMIT_JOB:
213 220
      logging.info("Received new job")
214 221
      ops = [opcodes.OpCode.LoadOpCode(state) for state in args]
......
333 340
  This class creates and holds common objects shared by all threads.
334 341

  
335 342
  """
343
  # pylint: disable-msg=W0212
344
  # we do want to ensure a singleton here
336 345
  _instance = None
337 346

  
338 347
  def __init__(self):
......
498 507
      # Call function
499 508
      result = int(bool(fn()))
500 509
      assert result in (0, 1)
501
    except:
510
    except: # pylint: disable-msg=W0702
502 511
      logging.exception("Error while calling function in separate process")
503 512
      # 0 and 1 are reserved for the return value
504 513
      result = 33
505 514

  
506
    os._exit(result)
515
    os._exit(result) # pylint: disable-msg=W0212
507 516

  
508 517
  # Parent process
509 518

  
......
544 553

  
545 554
    confirmation = sys.stdin.readline().strip()
546 555
    if confirmation != "YES":
547
      print >>sys.stderr, "Aborting."
556
      print >> sys.stderr, "Aborting."
548 557
      sys.exit(constants.EXIT_FAILURE)
549 558

  
550 559
    return
b/daemons/ganeti-noded
21 21

  
22 22
"""Ganeti node daemon"""
23 23

  
24
# functions in this module need to have a given name structure, so:
25
# pylint: disable-msg=C0103
24
# pylint: disable-msg=C0103,W0142
25

  
26
# C0103: Functions in this module need to have a given name structure,
27
# and the name of the daemon doesn't match
28

  
29
# W0142: Used * or ** magic, since we do use it extensively in this
30
# module
26 31

  
27 32
import os
28 33
import sys
......
66 71
  return wrapper
67 72

  
68 73

  
69
class NodeHttpServer(http.server.HttpServer):
74
class NodeHttpServer(http.server.HttpServer): # pylint: disable-msg=R0904
70 75
  """The server implementation.
71 76

  
72 77
  This class holds all methods exposed over the RPC interface.
......
786 791
  """Main node daemon function, executed with the PID file held.
787 792

  
788 793
  """
789
  global queue_lock
794
  global queue_lock # pylint: disable-msg=W0603
790 795

  
791 796
  # Read SSL certificate
792 797
  if options.ssl:
b/daemons/ganeti-rapi
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 19
# 02110-1301, USA.
20 20

  
21
""" Ganeti Remote API master script.
21
"""Ganeti Remote API master script.
22

  
22 23
"""
23 24

  
25
# pylint: disable-msg=C0103,W0142
26

  
27
# C0103: Invalid name ganeti-watcher
28

  
24 29
import glob
25 30
import logging
26 31
import optparse
b/daemons/ganeti-watcher
27 27

  
28 28
"""
29 29

  
30
# pylint: disable-msg=C0103,W0142
31

  
32
# C0103: Invalid name ganeti-watcher
33

  
30 34
import os
31 35
import sys
32 36
import time
......
115 119
        self._data = {}
116 120
      else:
117 121
        self._data = serializer.Load(state_data)
118
    except Exception, msg:
122
    except Exception, msg: # pylint: disable-msg=W0703
119 123
      # Ignore errors while loading the file and treat it as empty
120 124
      self._data = {}
121 125
      logging.warning(("Invalid state file. Using defaults."
......
369 373
          try:
370 374
            logging.info("Activating disks for instance %s", instance.name)
371 375
            instance.ActivateDisks()
372
          except Exception:
376
          except Exception: # pylint: disable-msg=W0703
373 377
            logging.exception("Error while activating disks for instance %s",
374 378
                              instance.name)
375 379

  
......
400 404
                        instance.name, last)
401 405
          instance.Restart()
402 406
          self.started_instances.add(instance.name)
403
        except Exception:
407
        except Exception: # pylint: disable-msg=W0703
404 408
          logging.exception("Error while restarting instance %s",
405 409
                            instance.name)
406 410

  
......
464 468
  """Main function.
465 469

  
466 470
  """
467
  global client
471
  global client # pylint: disable-msg=W0603
468 472

  
469 473
  options, args = ParseOptions()
470 474

  
b/lib/asyncnotifier.py
25 25
import asyncore
26 26

  
27 27
try:
28
  # pylint: disable-msg=E0611
28 29
  from pyinotify import pyinotify
29 30
except ImportError:
30 31
  import pyinotify
......
34 35
  """An asyncore dispatcher for inotify events.
35 36

  
36 37
  """
37

  
38
  # pylint: disable-msg=W0622,W0212
38 39
  def __init__(self, watch_manager, default_proc_fun=None, map=None):
39 40
    """Initializes this class.
40 41

  
b/lib/backend.py
392 392
    utils.RemoveFile(constants.HMAC_CLUSTER_KEY)
393 393
    utils.RemoveFile(constants.RAPI_CERT_FILE)
394 394
    utils.RemoveFile(constants.SSL_CERT_FILE)
395
  except:
395
  except: # pylint: disable-msg=W0702
396 396
    logging.exception("Error while removing cluster secrets")
397 397

  
398 398
  result = utils.RunCmd([constants.DAEMON_UTIL, "stop", constants.CONFD])
......
1195 1195
      it's not required to return anything.
1196 1196

  
1197 1197
  """
1198
  # TODO: remove the obsolete 'size' argument
1199
  # pylint: disable-msg=W0613
1198 1200
  clist = []
1199 1201
  if disk.children:
1200 1202
    for child in disk.children:
b/lib/build/__init__.py
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 19
# 02110-1301, USA.
20 20

  
21
"""Module used during the Ganeti build process"""
21 22

  
22 23
import imp
23 24
import os
b/lib/cli.py
170 170

  
171 171

  
172 172
class _Argument:
173
  def __init__(self, min=0, max=None):
173
  def __init__(self, min=0, max=None): # pylint: disable-msg=W0622
174 174
    self.min = min
175 175
    self.max = max
176 176

  
......
185 185
  Value can be any of the ones passed to the constructor.
186 186

  
187 187
  """
188
  # pylint: disable-msg=W0622
188 189
  def __init__(self, min=0, max=None, choices=None):
189 190
    _Argument.__init__(self, min=min, max=max)
190 191
    self.choices = choices
b/lib/cmdlib.py
261 261
    """
262 262
    raise NotImplementedError
263 263

  
264
  # this is valid in this entire class even if added here
265
  # pylint: disable-msg=R0201
264 266
  def HooksCallBack(self, phase, hook_results, feedback_fn, lu_result):
265 267
    """Notify the LU about the results of its hooks.
266 268

  
......
699 701
  }
700 702
  if override:
701 703
    args.update(override)
702
  return _BuildInstanceHookEnv(**args)
704
  return _BuildInstanceHookEnv(**args) # pylint: disable-msg=W0142
703 705

  
704 706

  
705 707
def _AdjustCandidatePool(lu, exceptions):
......
909 911
    try:
910 912
      hm.RunPhase(constants.HOOKS_PHASE_POST, [master])
911 913
    except:
914
      # pylint: disable-msg=W0702
912 915
      self.LogWarning("Errors occurred running hooks on %s" % master)
913 916

  
914 917
    result = self.rpc.call_node_stop_master(master, False)
......
1029 1032

  
1030 1033
    """
1031 1034
    node = nodeinfo.name
1032
    _ErrorIf = self._ErrorIf
1035
    _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103
1033 1036

  
1034 1037
    # main result, node_result should be a non-empty dict
1035 1038
    test = not node_result or not isinstance(node_result, dict)
......
1176 1179
    available on the instance's node.
1177 1180

  
1178 1181
    """
1179
    _ErrorIf = self._ErrorIf
1182
    _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103
1180 1183
    node_current = instanceconfig.primary_node
1181 1184

  
1182 1185
    node_vol_should = {}
......
1291 1294

  
1292 1295
    """
1293 1296
    self.bad = False
1294
    _ErrorIf = self._ErrorIf
1297
    _ErrorIf = self._ErrorIf # pylint: disable-msg=C0103
1295 1298
    verbose = self.op.verbose
1296 1299
    self._feedback_fn = feedback_fn
1297 1300
    feedback_fn("* Verifying global settings")
......
2476 2479
    try:
2477 2480
      hm.RunPhase(constants.HOOKS_PHASE_POST, [node.name])
2478 2481
    except:
2482
      # pylint: disable-msg=W0702
2479 2483
      self.LogWarning("Errors occurred running hooks on %s" % node.name)
2480 2484

  
2481 2485
    result = self.rpc.call_node_leave_cluster(node.name, modify_ssh_setup)
......
2489 2493
  """Logical unit for querying nodes.
2490 2494

  
2491 2495
  """
2496
  # pylint: disable-msg=W0142
2492 2497
  _OP_REQP = ["output_fields", "names", "use_locking"]
2493 2498
  REQ_BGL = False
2494 2499

  
......
3019 3024
    # later in the procedure; this also means that if the re-add
3020 3025
    # fails, we are left with a non-offlined, broken node
3021 3026
    if self.op.readd:
3022
      new_node.drained = new_node.offline = False
3027
      new_node.drained = new_node.offline = False # pylint: disable-msg=W0201
3023 3028
      self.LogInfo("Readding a node, the offline/drained flags were reset")
3024 3029
      # if we demote the node, we do cleanup later in the procedure
3025 3030
      new_node.master_candidate = self.master_candidate
......
4261 4266
  """Logical unit for querying instances.
4262 4267

  
4263 4268
  """
4269
  # pylint: disable-msg=W0142
4264 4270
  _OP_REQP = ["output_fields", "names", "use_locking"]
4265 4271
  REQ_BGL = False
4266 4272
  _SIMPLE_FIELDS = ["name", "os", "network_port", "hypervisor",
......
4322 4328
    """Computes the list of nodes and their attributes.
4323 4329

  
4324 4330
    """
4331
    # pylint: disable-msg=R0912
4332
    # way too many branches here
4325 4333
    all_info = self.cfg.GetAllInstancesInfo()
4326 4334
    if self.wanted == locking.ALL_SET:
4327 4335
      # caller didn't specify instance names, so ordering is not important
......
8454 8462
      easy usage
8455 8463

  
8456 8464
  """
8465
  # pylint: disable-msg=R0902
8466
  # lots of instance attributes
8457 8467
  _ALLO_KEYS = [
8458 8468
    "mem_size", "disks", "disk_template",
8459 8469
    "os", "tags", "nics", "vcpus", "hypervisor",
b/lib/confd/querylib.py
50 50
    """
51 51
    self.reader = reader
52 52

  
53
  def Exec(self, query):
53
  def Exec(self, query): # pylint: disable-msg=R0201
54 54
    """Process a single UDP request from a client.
55 55

  
56 56
    Different queries should override this function, which by defaults returns
b/lib/daemon.py
105 105
          raise
106 106
      ip, port = address
107 107
      self.handle_datagram(payload, ip, port)
108
    except:
108
    except: # pylint: disable-msg=W0702
109 109
      # we need to catch any exception here, log it, but proceed, because even
110 110
      # if we failed handling a single request, we still want to continue.
111 111
      logging.error("Unexpected exception", exc_info=True)
......
139 139
        else:
140 140
          raise
141 141
      self._out_queue.pop(0)
142
    except:
142
    except: # pylint: disable-msg=W0702
143 143
      # we need to catch any exception here, log it, but proceed, because even
144 144
      # if we failed sending a single datagram we still want to continue.
145 145
      logging.error("Unexpected exception", exc_info=True)
b/lib/http/__init__.py
299 299
  code = 505
300 300

  
301 301

  
302
class HttpJsonConverter:
302
class HttpJsonConverter: # pylint: disable-msg=W0232
303 303
  CONTENT_TYPE = "application/json"
304 304

  
305 305
  def Encode(self, data):
b/lib/http/client.py
333 333
  """HTTP client worker class.
334 334

  
335 335
  """
336
  def RunTask(self, pend_req):
336
  def RunTask(self, pend_req): # pylint: disable-msg=W0221
337 337
    try:
338 338
      HttpClientRequestExecutor(pend_req.request)
339 339
    finally:
b/lib/http/server.py
514 514
    """Called for each incoming connection
515 515

  
516 516
    """
517
    # pylint: disable-msg=W0212
517 518
    (connection, client_addr) = self.socket.accept()
518 519

  
519 520
    self._CollectChildren(False)
......
533 534
        self.socket = None
534 535

  
535 536
        self.request_executor(self, connection, client_addr)
536
      except Exception:
537
      except Exception: # pylint: disable-msg=W0703
537 538
        logging.exception("Error while handling request from %s:%s",
538 539
                          client_addr[0], client_addr[1])
539 540
        os._exit(1)
b/lib/hypervisor/hv_base.py
190 190
    """
191 191
    raise NotImplementedError
192 192

  
193
  def MigrationInfo(self, instance):
193
  def MigrationInfo(self, instance): # pylint: disable-msg=R0201,W0613
194 194
    """Get instance information to perform a migration.
195 195

  
196 196
    By default assume no information is needed.
b/lib/jqueue.py
154 154
  @ivar change: a Condition variable we use for waiting for job changes
155 155

  
156 156
  """
157
  # pylint: disable-msg=W0212
157 158
  __slots__ = ["queue", "id", "ops", "log_serial",
158 159
               "received_timestamp", "start_timestamp", "end_timestamp",
159 160
               "lock_status", "change",
......
419 420
  """The actual job workers.
420 421

  
421 422
  """
422
  def RunTask(self, job):
423
  def RunTask(self, job): # pylint: disable-msg=W0221
423 424
    """Job executor.
424 425

  
425 426
    This functions processes a job. It is closely tied to the _QueuedJob and
......
559 560

  
560 561
  """
561 562
  def wrapper(self, *args, **kwargs):
563
    # pylint: disable-msg=W0212
562 564
    assert self._queue_lock is not None, "Queue should be open"
563 565
    return fn(self, *args, **kwargs)
564 566
  return wrapper
......
963 965

  
964 966
    try:
965 967
      job = _QueuedJob.Restore(self, data)
966
    except Exception, err:
968
    except Exception, err: # pylint: disable-msg=W0703
967 969
      new_path = self._GetArchivedJobPath(job_id)
968 970
      if filepath == new_path:
969 971
        # job already archived (future case)
b/lib/locking.py
287 287
      if self._nwaiters == 0:
288 288
        self._Cleanup()
289 289

  
290
  def notifyAll(self):
290
  def notifyAll(self): # pylint: disable-msg=C0103
291 291
    """Close the writing side of the pipe to notify all waiters.
292 292

  
293 293
    """
......
345 345
      assert self._nwaiters > 0
346 346
      self._nwaiters -= 1
347 347

  
348
  def notifyAll(self):
348
  def notifyAll(self): # pylint: disable-msg=C0103
349 349
    """Notify all currently waiting threads.
350 350

  
351 351
    """
......
382 382
    self._cond = threading.Condition(lock=lock)
383 383
    self._nwaiters = 0
384 384

  
385
  def notifyAll(self):
385
  def notifyAll(self): # pylint: disable-msg=C0103
386 386
    """Notifies the condition.
387 387

  
388 388
    """
b/lib/luxi.py
286 286
      old_transp = self.transport
287 287
      self.transport = None
288 288
      old_transp.Close()
289
    except Exception:
289
    except Exception: # pylint: disable-msg=W0703
290 290
      pass
291 291

  
292 292
  def CallMethod(self, method, args):
b/lib/mcpu.py
136 136
    return timeout
137 137

  
138 138

  
139
class OpExecCbBase:
139
class OpExecCbBase: # pylint: disable-msg=W0232
140 140
  """Base class for OpCode execution callbacks.
141 141

  
142 142
  """
b/lib/objects.py
26 26

  
27 27
"""
28 28

  
29
# pylint: disable-msg=E0203
29
# pylint: disable-msg=E0203,W0201
30 30

  
31 31
# E0203: Access to member %r before its definition, since we use
32 32
# objects.py which doesn't explicitely initialise its members
33 33

  
34
# W0201: Attribute '%s' defined outside __init__
34 35

  
35 36
import ConfigParser
36 37
import re
......
153 154
      raise errors.ConfigurationError("Invalid object passed to FromDict:"
154 155
                                      " expected dict, got %s" % type(val))
155 156
    val_str = dict([(str(k), v) for k, v in val.iteritems()])
156
    obj = cls(**val_str)
157
    obj = cls(**val_str) # pylint: disable-msg=W0142
157 158
    return obj
158 159

  
159 160
  @staticmethod
b/lib/rapi/__init__.py
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 19
# 02110-1301, USA.
20 20

  
21
"""Ganeti RAPI module"""
21 22

  
22 23
RAPI_ACCESS_WRITE = "write"
b/lib/rapi/rlib2.py
672 672
    Example: ["tag1", "tag2", "tag3"]
673 673

  
674 674
    """
675
    # pylint: disable-msg=W0212
675 676
    return baserlib._Tags_GET(self.TAG_LEVEL, name=self.name)
676 677

  
677 678
  def PUT(self):
......
681 682
    you'll have back a job id.
682 683

  
683 684
    """
685
    # pylint: disable-msg=W0212
684 686
    if 'tag' not in self.queryargs:
685 687
      raise http.HttpBadRequest("Please specify tag(s) to add using the"
686 688
                                " the 'tag' parameter")
......
696 698
    /tags?tag=[tag]&tag=[tag]
697 699

  
698 700
    """
701
    # pylint: disable-msg=W0212
699 702
    if 'tag' not in self.queryargs:
700 703
      # no we not gonna delete all tags
701 704
      raise http.HttpBadRequest("Cannot delete all tags - please specify"
b/lib/rpc.py
163 163
      args = (msg, prereq)
164 164
    else:
165 165
      args = (msg, )
166
    raise ec(*args)
166
    raise ec(*args) # pylint: disable-msg=W0142
167 167

  
168 168

  
169 169
class Client:
b/lib/storage.py
23 23

  
24 24
"""
25 25

  
26
# pylint: disable-msg=W0232,R0201
27

  
28
# W0232, since we use these as singletons rather than object holding
29
# data
30

  
31
# R0201, for the same reason
32

  
33
# TODO: FileStorage initialised with paths whereas the others not
26 34

  
27 35
import logging
28 36

  
......
50 58
    """
51 59
    raise NotImplementedError()
52 60

  
53
  def Modify(self, name, changes):
61
  def Modify(self, name, changes): # pylint: disable-msg=W0613
54 62
    """Modifies an entity within the storage unit.
55 63

  
56 64
    @type name: string
......
76 84
    raise NotImplementedError()
77 85

  
78 86

  
79
class FileStorage(_Base):
87
class FileStorage(_Base): # pylint: disable-msg=W0223
80 88
  """File storage unit.
81 89

  
82 90
  """
......
153 161
    return values
154 162

  
155 163

  
156
class _LvmBase(_Base):
164
class _LvmBase(_Base): # pylint: disable-msg=W0223
157 165
  """Base class for LVM storage containers.
158 166

  
159 167
  @cvar LIST_FIELDS: list of tuples consisting of three elements: SF_*
......
248 256

  
249 257
        if callable(mapper):
250 258
          # we got a function, call it with all the declared fields
251
          val = mapper(*values)
259
          val = mapper(*values) # pylint: disable-msg=W0142
252 260
        elif len(values) == 1:
253 261
          # we don't have a function, but we had a single field
254 262
          # declared, pass it unchanged
......
324 332
      yield fields
325 333

  
326 334

  
327
class LvmPvStorage(_LvmBase):
335
class LvmPvStorage(_LvmBase): # pylint: disable-msg=W0223
328 336
  """LVM Physical Volume storage unit.
329 337

  
330 338
  """
b/lib/utils.py
1369 1369
  return None
1370 1370

  
1371 1371

  
1372
def all(seq, pred=bool):
1372
def all(seq, pred=bool): # pylint: disable-msg=W0622
1373 1373
  "Returns True if pred(x) is True for every element in the iterable"
1374 1374
  for _ in itertools.ifilterfalse(pred, seq):
1375 1375
    return False
1376 1376
  return True
1377 1377

  
1378 1378

  
1379
def any(seq, pred=bool):
1379
def any(seq, pred=bool): # pylint: disable-msg=W0622
1380 1380
  "Returns True if pred(x) is True for at least one element in the iterable"
1381 1381
  for _ in itertools.ifilter(pred, seq):
1382 1382
    return True
......
1493 1493
  @return: the value zero
1494 1494

  
1495 1495
  """
1496
  # pylint: disable-msg=W0212
1497
  # yes, we really want os._exit
1496 1498
  UMASK = 077
1497 1499
  WORKDIR = "/"
1498 1500

  
......
1567 1569
  # TODO: we could check here that the file contains our pid
1568 1570
  try:
1569 1571
    RemoveFile(pidfilename)
1570
  except:
1572
  except: # pylint: disable-msg=W0702
1571 1573
    pass
1572 1574

  
1573 1575

  
......
1958 1960
      logging.debug(*args, **kwargs)
1959 1961

  
1960 1962
  def wrapper(self, *args, **kwargs):
1963
    # pylint: disable-msg=W0212
1961 1964
    assert hasattr(self, '_lock')
1962 1965
    lock = self._lock
1963 1966
    _LockDebug("Waiting for %s", lock)
......
2164 2167

  
2165 2168
  while True:
2166 2169
    try:
2170
      # pylint: disable-msg=W0142
2167 2171
      return fn(*args)
2168 2172
    except RetryAgain:
2169 2173
      pass
b/lib/workerpool.py
34 34
  Users of a worker pool must override RunTask in a subclass.
35 35

  
36 36
  """
37
  # pylint: disable-msg=W0212
37 38
  def __init__(self, pool, worker_id):
38 39
    """Constructor for BaseWorker thread.
39 40

  
......
118 119
          self.RunTask(*self._current_task)
119 120
          logging.debug("Worker %s: done with task %r",
120 121
                        self.worker_id, self._current_task)
121
        except:
122
        except: # pylint: disable-msg=W0702
122 123
          logging.error("Worker %s: Caught unhandled exception",
123 124
                        self.worker_id, exc_info=True)
124 125
      finally:
......
223 224

  
224 225
    """
225 226
    for worker in self._workers + self._termworkers:
226
      if worker._HasRunningTaskUnlocked():
227
      if worker._HasRunningTaskUnlocked(): # pylint: disable-msg=W0212
227 228
        return True
228 229
    return False
229 230

  
b/scripts/gnt-backup
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 19
# 02110-1301, USA.
20 20

  
21
"""Backup related commands"""
21 22

  
22
# pylint: disable-msg=W0401,W0614
23
# pylint: disable-msg=W0401,W0614,C0103
23 24
# W0401: Wildcard import ganeti.cli
24 25
# W0614: Unused import %s from wildcard import (since we need cli)
26
# C0103: Invalid name gnt-backup
25 27

  
26 28
import sys
27 29

  
b/scripts/gnt-cluster
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 19
# 02110-1301, USA.
20 20

  
21
"""Cluster related commands"""
21 22

  
22
# pylint: disable-msg=W0401,W0614
23
# pylint: disable-msg=W0401,W0614,C0103
23 24
# W0401: Wildcard import ganeti.cli
24 25
# W0614: Unused import %s from wildcard import (since we need cli)
26
# C0103: Invalid name gnt-cluster
25 27

  
26 28
import sys
27 29
import os.path
b/scripts/gnt-debug
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 19
# 02110-1301, USA.
20 20

  
21
"""Debugging commands"""
21 22

  
22
# pylint: disable-msg=W0401,W0614
23
# pylint: disable-msg=W0401,W0614,C0103
23 24
# W0401: Wildcard import ganeti.cli
24 25
# W0614: Unused import %s from wildcard import (since we need cli)
26
# C0103: Invalid name gnt-backup
25 27

  
26 28
import sys
27 29
import simplejson
......
77 79
    ToStdout("Loading...")
78 80
  for job_idx in range(opts.rep_job):
79 81
    for fname in args:
82
      # pylint: disable-msg=W0142
80 83
      op_data = simplejson.loads(utils.ReadFile(fname))
81 84
      op_list = [opcodes.OpCode.LoadOpCode(val) for val in op_data]
82 85
      op_list = op_list * opts.rep_op
b/scripts/gnt-instance
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 19
# 02110-1301, USA.
20 20

  
21
"""Instance related commands"""
21 22

  
22
# pylint: disable-msg=W0401,W0614
23
# pylint: disable-msg=W0401,W0614,C0103
23 24
# W0401: Wildcard import ganeti.cli
24 25
# W0614: Unused import %s from wildcard import (since we need cli)
26
# C0103: Invalid name gnt-instance
25 27

  
26 28
import sys
27 29
import os
......
75 77
  @raise errors.OpPrereqError: for invalid input parameters
76 78

  
77 79
  """
80
  # pylint: disable-msg=W0142
78 81
  if client is None:
79 82
    client = GetClient()
80 83
  if mode == _SHUTDOWN_CLUSTER:
......
395 398
  json_filename = args[0]
396 399
  try:
397 400
    instance_data = simplejson.loads(utils.ReadFile(json_filename))
398
  except Exception, err:
401
  except Exception, err: # pylint: disable-msg=W0703
399 402
    ToStderr("Can't parse the instance definition file: %s" % str(err))
400 403
    return 1
401 404

  
......
911 914
    finally:
912 915
      ToStderr("Can't run console command %s with arguments:\n'%s'",
913 916
               cmd[0], " ".join(cmd))
914
      os._exit(1)
917
      os._exit(1) # pylint: disable-msg=W0212
915 918

  
916 919

  
917 920
def _FormatLogicalID(dev_type, logical_id):
b/scripts/gnt-job
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 19
# 02110-1301, USA.
20 20

  
21
"""Job related commands"""
21 22

  
22
# pylint: disable-msg=W0401,W0614
23
# pylint: disable-msg=W0401,W0614,C0103
23 24
# W0401: Wildcard import ganeti.cli
24 25
# W0614: Unused import %s from wildcard import (since we need cli)
26
# C0103: Invalid name gnt-job
25 27

  
26 28
import sys
27 29

  
b/scripts/gnt-node
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 19
# 02110-1301, USA.
20 20

  
21
"""Node related commands"""
21 22

  
22
# pylint: disable-msg=W0401,W0614
23
# pylint: disable-msg=W0401,W0614,C0103
23 24
# W0401: Wildcard import ganeti.cli
24 25
# W0614: Unused import %s from wildcard import (since we need cli)
26
# C0103: Invalid name gnt-node
25 27

  
26 28
import sys
27 29

  
b/scripts/gnt-os
18 18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 19
# 02110-1301, USA.
20 20

  
21
"""OS scripts related commands"""
21 22

  
22
# pylint: disable-msg=W0401,W0614
23
# pylint: disable-msg=W0401,W0614,C0103
23 24
# W0401: Wildcard import ganeti.cli
24 25
# W0614: Unused import %s from wildcard import (since we need cli)
26
# C0103: Invalid name gnt-os
25 27

  
26 28
import sys
27 29

  
b/tools/burnin
83 83

  
84 84
class SimpleOpener(urllib.FancyURLopener):
85 85
  """A simple url opener"""
86
  # pylint: disable-msg=W0221
86 87

  
87
  def prompt_user_passwd(self, host, realm, clear_cache = 0):
88
  def prompt_user_passwd(self, host, realm, clear_cache=0):
88 89
    """No-interaction version of prompt_user_passwd."""
89 90
    return None, None
90 91

  
......
208 209
  def wrapper(self, *args, **kwargs):
209 210
    val = fn(self, *args, **kwargs)
210 211
    for instance in self.instances:
211
      self._CheckInstanceAlive(instance)
212
      self._CheckInstanceAlive(instance) # pylint: disable-msg=W0212
212 213
    return val
213 214

  
214 215
  return wrapper
......
289 290
        Log("Idempotent %s succeeded after %d retries" %
290 291
            (msg, MAX_RETRIES - retry_count))
291 292
      return val
292
    except Exception, err:
293
    except Exception, err: # pylint: disable-msg=W0703
293 294
      if retry_count == 0:
294 295
        Log("Non-idempotent %s failed, aborting" % (msg, ))
295 296
        raise
......
377 378
      Log("waiting for job %s for %s" % (jid, iname), indent=2)
378 379
      try:
379 380
        results.append(cli.PollJob(jid, cl=self.cl, feedback_fn=self.Feedback))
380
      except Exception, err:
381
      except Exception, err: # pylint: disable-msg=W0703
381 382
        Log("Job for %s failed: %s" % (iname, err))
382 383
    if len(results) != len(jobs):
383 384
      raise BurninFailure()
......
544 545
                                    disks=[i for i in range(self.disk_count)])
545 546
        Log("run %s" % mode, indent=2)
546 547
        ops.append(op)
547
      self.ExecOrQueue(instance, *ops)
548
      self.ExecOrQueue(instance, *ops) # pylint: disable-msg=W0142
548 549

  
549 550
  @_DoBatch(True)
550 551
  def BurnReplaceDisks2(self):
......
760 761
                                      ignore_secondaries=False)
761 762
        Log("reboot with type '%s'" % reboot_type, indent=2)
762 763
        ops.append(op)
763
      self.ExecOrQueue(instance, *ops)
764
      self.ExecOrQueue(instance, *ops) # pylint: disable-msg=W0142
764 765

  
765 766
  @_DoCheckInstances
766 767
  @_DoBatch(True)
......
913 914
      if not self.opts.keep_instances:
914 915
        try:
915 916
          self.BurnRemove()
916
        except Exception, err:
917
        except Exception, err:  # pylint: disable-msg=W0703
917 918
          if has_err: # already detected errors, so errors in removal
918 919
                      # are quite expected
919 920
            Log("Note: error detected during instance remove: %s" % str(err))
b/tools/cfgshell
152 152
      arg = None
153 153
    try:
154 154
      self.cfg = config.ConfigWriter(cfg_file=arg, offline=True)
155
      self.parents = [self.cfg._config_data]
155
      self.parents = [self.cfg._config_data] # pylint: disable-msg=W0212
156 156
      self.path = []
157 157
    except errors.ConfigurationError, err:
158 158
      print "Error: %s" % str(err)
......
284 284
    if self.cfg.VerifyConfig():
285 285
      print "Config data does not validate, refusing to save."
286 286
      return False
287
    self.cfg._WriteConfig()
287
    self.cfg._WriteConfig() # pylint: disable-msg=W0212
288 288

  
289 289
  def do_rm(self, line):
290 290
    """Removes an instance or a node.
......
294 294

  
295 295
    """
296 296
    pointer = self.parents[-1]
297
    data = self.cfg._config_data
297
    data = self.cfg._config_data  # pylint: disable-msg=W0212
298 298
    if pointer not in (data.instances, data.nodes):
299 299
      print "Can only delete instances and nodes"
300 300
      return False
b/tools/cfgupgrade
98 98
  """Main program.
99 99

  
100 100
  """
101
  global options, args
101
  global options, args # pylint: disable-msg=W0603
102 102

  
103 103
  program = os.path.basename(sys.argv[0])
104 104

  
b/tools/lvmstrap
130 130
  Returns:
131 131
    (options, args), as returned by OptionParser.parse_args
132 132
  """
133
  global verbose_flag
133
  global verbose_flag # pylint: disable-msg=W0603
134 134

  
135 135
  parser = optparse.OptionParser(usage="\n%s" % USAGE,
136 136
                                 version="%%prog (ganeti) %s" %

Also available in: Unified diff