From 006b9a494e2bc53864f903bf1d3f3219e1ab6d62 Mon Sep 17 00:00:00 2001 From: Allen Zhong Date: Tue, 12 Jan 2021 19:10:29 +0800 Subject: [PATCH] cluster: fix unique host set --- pkg/cluster/manager/exec.go | 4 ++-- pkg/cluster/manager/transfer.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/cluster/manager/exec.go b/pkg/cluster/manager/exec.go index e145f5d9d3..c02e79f0cd 100644 --- a/pkg/cluster/manager/exec.go +++ b/pkg/cluster/manager/exec.go @@ -47,9 +47,9 @@ func (m *Manager) Exec(name string, opt ExecOptions, gOpt operator.Options) erro filterNodes := set.NewStringSet(gOpt.Nodes...) var shellTasks []task.Task - uniqueHosts := map[string]set.StringSet{} // host-sshPort-port -> {command} + uniqueHosts := map[string]set.StringSet{} // host-sshPort -> {command} topo.IterInstance(func(inst spec.Instance) { - key := fmt.Sprintf("%s-%d-%d", inst.GetHost(), inst.GetSSHPort(), inst.GetPort()) + key := fmt.Sprintf("%s-%d", inst.GetHost(), inst.GetSSHPort()) if _, found := uniqueHosts[key]; !found { if len(gOpt.Roles) > 0 && !filterRoles.Exist(inst.Role()) { return diff --git a/pkg/cluster/manager/transfer.go b/pkg/cluster/manager/transfer.go index 332464277a..128d26e195 100644 --- a/pkg/cluster/manager/transfer.go +++ b/pkg/cluster/manager/transfer.go @@ -51,9 +51,9 @@ func (m *Manager) Transfer(name string, opt TransferOptions, gOpt operator.Optio var shellTasks []task.Task - uniqueHosts := map[string]set.StringSet{} // host-sshPort-port -> {remote-path} + uniqueHosts := map[string]set.StringSet{} // host-sshPort -> {remote-path} topo.IterInstance(func(inst spec.Instance) { - key := fmt.Sprintf("%s-%d-%d", inst.GetHost(), inst.GetSSHPort(), inst.GetPort()) + key := fmt.Sprintf("%s-%d", inst.GetHost(), inst.GetSSHPort()) if _, found := uniqueHosts[key]; !found { if len(gOpt.Roles) > 0 && !filterRoles.Exist(inst.Role()) { return