@@ -88,13 +88,13 @@ func NewSSHClient(ssh *v1.SSH, alsoToStdout bool) Interface {
88
88
89
89
// GetHostSSHClient is used to executed bash command and no std out to be printed.
90
90
func GetHostSSHClient (hostIP net.IP , cluster * v2.Cluster ) (Interface , error ) {
91
- for _ , host := range cluster .Spec .Hosts {
92
- for _ , ip := range host .IPS {
91
+ for i := range cluster .Spec .Hosts {
92
+ for _ , ip := range cluster . Spec . Hosts [ i ] .IPS {
93
93
if hostIP .Equal (ip ) {
94
- if err := mergo .Merge (& host .SSH , & cluster .Spec .SSH ); err != nil {
94
+ if err := mergo .Merge (& cluster . Spec . Hosts [ i ] .SSH , & cluster .Spec .SSH ); err != nil {
95
95
return nil , err
96
96
}
97
- return NewSSHClient (& host .SSH , false ), nil
97
+ return NewSSHClient (& cluster . Spec . Hosts [ i ] .SSH , false ), nil
98
98
}
99
99
}
100
100
}
@@ -103,13 +103,13 @@ func GetHostSSHClient(hostIP net.IP, cluster *v2.Cluster) (Interface, error) {
103
103
104
104
// NewStdoutSSHClient is used to show std out when execute bash command.
105
105
func NewStdoutSSHClient (hostIP net.IP , cluster * v2.Cluster ) (Interface , error ) {
106
- for _ , host := range cluster .Spec .Hosts {
107
- for _ , ip := range host .IPS {
106
+ for i := range cluster .Spec .Hosts {
107
+ for _ , ip := range cluster . Spec . Hosts [ i ] .IPS {
108
108
if hostIP .Equal (ip ) {
109
- if err := mergo .Merge (& host .SSH , & cluster .Spec .SSH ); err != nil {
109
+ if err := mergo .Merge (& cluster . Spec . Hosts [ i ] .SSH , & cluster .Spec .SSH ); err != nil {
110
110
return nil , err
111
111
}
112
- return NewSSHClient (& host .SSH , true ), nil
112
+ return NewSSHClient (& cluster . Spec . Hosts [ i ] .SSH , true ), nil
113
113
}
114
114
}
115
115
}
0 commit comments