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

cluster-merge should refuse to merge own cluster



Also fix type of Merger.cluster_name from list to string. This would
have triggered an error in sshRunner if cluster keys were in use.
Signed-off-by: default avatarStephen Shirley <diamond@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 7e975535
......@@ -102,7 +102,7 @@ class Merger(object):
self.clusters = clusters
self.pause_period = pause_period
self.work_dir = tempfile.mkdtemp(suffix="cluster-merger")
self.cluster_name = cli.GetClient().QueryConfigValues(["cluster_name"])
(self.cluster_name, ) = cli.GetClient().QueryConfigValues(["cluster_name"])
self.ssh_runner = ssh.SshRunner(self.cluster_name)
def Setup(self):
......@@ -116,6 +116,10 @@ class Merger(object):
"""
(remote_path, _, _) = ssh.GetUserFiles("root")
if self.cluster_name in self.clusters:
raise errors.CommandError("Cannot merge cluster %s with itself" %
self.cluster_name)
# Fetch remotes private key
for cluster in self.clusters:
result = self._RunCmd(cluster, "cat %s" % remote_path, batch=False,
......
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