Commit 9b945588 authored by Stephen Shirley's avatar Stephen Shirley Committed by Guido Trotter
Browse files

Fix pylint warnings



- 1 80-char line infraction
- 4 changes in how arguments are passed to logging functions
- 3 pylint disable-msg's because cluster-merge needs to access ganeti
  config internals
Signed-off-by: default avatarStephen Shirley <diamond@google.com>
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent f0b1bafe
...@@ -52,7 +52,8 @@ PAUSE_PERIOD_OPT = cli.cli_option("-p", "--watcher-pause-period", default=1800, ...@@ -52,7 +52,8 @@ PAUSE_PERIOD_OPT = cli.cli_option("-p", "--watcher-pause-period", default=1800,
help=("Amount of time in seconds watcher" help=("Amount of time in seconds watcher"
" should be suspended from running")) " should be suspended from running"))
GROUPS_OPT = cli.cli_option("--groups", default=None, metavar="STRATEGY", GROUPS_OPT = cli.cli_option("--groups", default=None, metavar="STRATEGY",
choices=(_GROUPS_MERGE, _GROUPS_RENAME), dest="groups", choices=(_GROUPS_MERGE, _GROUPS_RENAME),
dest="groups",
help=("How to handle groups that have the" help=("How to handle groups that have the"
" same name (One of: %s/%s)" % " same name (One of: %s/%s)" %
(_GROUPS_MERGE, _GROUPS_RENAME))) (_GROUPS_MERGE, _GROUPS_RENAME)))
...@@ -314,7 +315,7 @@ class Merger(object): ...@@ -314,7 +315,7 @@ class Merger(object):
ConfigWriter.AddNodeGroup takes care of making sure there are no conflicts. ConfigWriter.AddNodeGroup takes care of making sure there are no conflicts.
""" """
# pylint: disable-msg=R0201 # pylint: disable-msg=R0201
logging.info("Node group conflict strategy: %s" % self.groups) logging.info("Node group conflict strategy: %s", self.groups)
my_grps = my_config.GetAllNodeGroupsInfo().values() my_grps = my_config.GetAllNodeGroupsInfo().values()
other_grps = other_config.GetAllNodeGroupsInfo().values() other_grps = other_config.GetAllNodeGroupsInfo().values()
...@@ -328,7 +329,7 @@ class Merger(object): ...@@ -328,7 +329,7 @@ class Merger(object):
if conflicts: if conflicts:
conflict_names = utils.CommaJoin([g.name for g in conflicts]) conflict_names = utils.CommaJoin([g.name for g in conflicts])
logging.info("Node groups in both local and remote cluster: %s" % logging.info("Node groups in both local and remote cluster: %s",
conflict_names) conflict_names)
# User hasn't specified how to handle conflicts # User hasn't specified how to handle conflicts
...@@ -343,18 +344,25 @@ class Merger(object): ...@@ -343,18 +344,25 @@ class Merger(object):
for grp in conflicts: for grp in conflicts:
new_name = "%s-%s" % (grp.name, other_config.GetClusterName()) new_name = "%s-%s" % (grp.name, other_config.GetClusterName())
logging.info("Renaming remote node group from %s to %s" logging.info("Renaming remote node group from %s to %s"
" to resolve conflict" % (grp.name, new_name)) " to resolve conflict", grp.name, new_name)
grp.name = new_name grp.name = new_name
# User wants to merge conflicting groups # User wants to merge conflicting groups
elif self.groups == 'merge': elif self.groups == 'merge':
for other_grp in conflicts: for other_grp in conflicts:
logging.info("Merging local and remote '%s' groups" % other_grp.name) logging.info("Merging local and remote '%s' groups", other_grp.name)
for node_name in other_grp.members[:]: for node_name in other_grp.members[:]:
node = other_config.GetNodeInfo(node_name) node = other_config.GetNodeInfo(node_name)
# Access to a protected member of a client class
# pylint: disable-msg=W0212
other_config._UnlockedRemoveNodeFromGroup(node) other_config._UnlockedRemoveNodeFromGroup(node)
# Access to a protected member of a client class
# pylint: disable-msg=W0212
my_grp_uuid = my_config._UnlockedLookupNodeGroup(other_grp.name) my_grp_uuid = my_config._UnlockedLookupNodeGroup(other_grp.name)
# Access to a protected member of a client class
# pylint: disable-msg=W0212
my_config._UnlockedAddNodeToGroup(node, my_grp_uuid) my_config._UnlockedAddNodeToGroup(node, my_grp_uuid)
node.group = my_grp_uuid node.group = my_grp_uuid
# Remove from list of groups to add # Remove from list of groups to add
......
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