Commit 6f1da8b3 authored by Iustin Pop's avatar Iustin Pop
Browse files

Merge branch 'devel-2.6'



* devel-2.6:
  Fix warnings/errors with newer pylint
  Fix decorator uses which crash newer pylint
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarBernardo Dal Seno <bdalseno@google.com>
parents 2a9aff11 fa0003dc
...@@ -960,9 +960,8 @@ def _RunPostHook(lu, node_name): ...@@ -960,9 +960,8 @@ def _RunPostHook(lu, node_name):
hm = lu.proc.BuildHooksManager(lu) hm = lu.proc.BuildHooksManager(lu)
try: try:
hm.RunPhase(constants.HOOKS_PHASE_POST, nodes=[node_name]) hm.RunPhase(constants.HOOKS_PHASE_POST, nodes=[node_name])
except: except Exception, err: # pylint: disable=W0703
# pylint: disable=W0702 lu.LogWarning("Errors occurred running hooks on %s: %s" % (node_name, err))
lu.LogWarning("Errors occurred running hooks on %s" % node_name)
   
   
def _CheckOutputFields(static, dynamic, selected): def _CheckOutputFields(static, dynamic, selected):
......
# #
# #
# Copyright (C) 2010 Google Inc. # Copyright (C) 2010, 2011, 2012 Google Inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -280,8 +280,8 @@ def TcpPing(target, port, timeout=10, live_port_needed=False, source=None): ...@@ -280,8 +280,8 @@ def TcpPing(target, port, timeout=10, live_port_needed=False, source=None):
if source is not None: if source is not None:
try: try:
sock.bind((source, 0)) sock.bind((source, 0))
except socket.error, (errcode, _): except socket.error, err:
if errcode == errno.EADDRNOTAVAIL: if err[0] == errno.EADDRNOTAVAIL:
success = False success = False
sock.settimeout(timeout) sock.settimeout(timeout)
...@@ -292,8 +292,8 @@ def TcpPing(target, port, timeout=10, live_port_needed=False, source=None): ...@@ -292,8 +292,8 @@ def TcpPing(target, port, timeout=10, live_port_needed=False, source=None):
success = True success = True
except socket.timeout: except socket.timeout:
success = False success = False
except socket.error, (errcode, _): except socket.error, err:
success = (not live_port_needed) and (errcode == errno.ECONNREFUSED) success = (not live_port_needed) and (err[0] == errno.ECONNREFUSED)
return success return success
......
...@@ -51,6 +51,7 @@ from ganeti import ssconf ...@@ -51,6 +51,7 @@ from ganeti import ssconf
from ganeti import ht from ganeti import ht
import ganeti.rapi.client # pylint: disable=W0611 import ganeti.rapi.client # pylint: disable=W0611
from ganeti.rapi.client import UsesRapiClient
from ganeti.watcher import nodemaint from ganeti.watcher import nodemaint
from ganeti.watcher import state from ganeti.watcher import state
...@@ -569,7 +570,7 @@ def _CheckMaster(cl): ...@@ -569,7 +570,7 @@ def _CheckMaster(cl):
raise NotMasterError("This is not the master node") raise NotMasterError("This is not the master node")
@rapi.client.UsesRapiClient @UsesRapiClient
def _GlobalWatcher(opts): def _GlobalWatcher(opts):
"""Main function for global watcher. """Main function for global watcher.
......
...@@ -45,10 +45,11 @@ import qa_tags ...@@ -45,10 +45,11 @@ import qa_tags
import qa_utils import qa_utils
from ganeti import utils from ganeti import utils
from ganeti import rapi from ganeti import rapi # pylint: disable=W0611
from ganeti import constants from ganeti import constants
import ganeti.rapi.client # pylint: disable=W0611 import ganeti.rapi.client # pylint: disable=W0611
from ganeti.rapi.client import UsesRapiClient
def _FormatHeader(line, end=72): def _FormatHeader(line, end=72):
...@@ -574,7 +575,7 @@ def RunQa(): ...@@ -574,7 +575,7 @@ def RunQa():
RunTestIf("cluster-destroy", qa_cluster.TestClusterDestroy) RunTestIf("cluster-destroy", qa_cluster.TestClusterDestroy)
@rapi.client.UsesRapiClient @UsesRapiClient
def main(): def main():
"""Main program. """Main program.
......
...@@ -80,7 +80,7 @@ def Validate(): ...@@ -80,7 +80,7 @@ def Validate():
def get(name, default=None): def get(name, default=None):
return cfg.get(name, default) return cfg.get(name, default) # pylint: disable=E1103
class Either: class Either:
...@@ -149,7 +149,7 @@ def TestEnabled(tests, _cfg=None): ...@@ -149,7 +149,7 @@ def TestEnabled(tests, _cfg=None):
_cfg = cfg _cfg = cfg
# Get settings for all tests # Get settings for all tests
cfg_tests = _cfg.get("tests", {}) cfg_tests = _cfg.get("tests", {}) # pylint: disable=E1103
# Get default setting # Get default setting
default = cfg_tests.get("default", True) default = cfg_tests.get("default", True)
...@@ -162,7 +162,7 @@ def GetInstanceCheckScript(): ...@@ -162,7 +162,7 @@ def GetInstanceCheckScript():
"""Returns path to instance check script or C{None}. """Returns path to instance check script or C{None}.
""" """
return cfg.get(_INSTANCE_CHECK_KEY, None) return cfg.get(_INSTANCE_CHECK_KEY, None) # pylint: disable=E1103
def GetEnabledHypervisors(): def GetEnabledHypervisors():
......
#!/usr/bin/python #!/usr/bin/python
# #
# Copyright (C) 2010 Google Inc. # Copyright (C) 2010, 2011, 2012 Google Inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -42,6 +42,7 @@ from ganeti import rapi ...@@ -42,6 +42,7 @@ from ganeti import rapi
import ganeti.rapi.client # pylint: disable=W0611 import ganeti.rapi.client # pylint: disable=W0611
import ganeti.rapi.client_utils import ganeti.rapi.client_utils
from ganeti.rapi.client import UsesRapiClient
SRC_RAPI_PORT_OPT = \ SRC_RAPI_PORT_OPT = \
...@@ -836,7 +837,7 @@ def CheckOptions(parser, options, args): ...@@ -836,7 +837,7 @@ def CheckOptions(parser, options, args):
return (src_cluster_name, dest_cluster_name, instance_names) return (src_cluster_name, dest_cluster_name, instance_names)
@rapi.client.UsesRapiClient @UsesRapiClient
def main(): def main():
"""Main routine. """Main routine.
......
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