Skip to content

Commit

Permalink
cluster: fix unique host set
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroProfundis committed Jan 12, 2021
1 parent 06567b2 commit 006b9a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/cluster/manager/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/cluster/manager/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 006b9a4

Please sign in to comment.