forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssh_dialer.go
38 lines (32 loc) · 843 Bytes
/
ssh_dialer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package dialer
import (
"fmt"
"github.com/rancher/rke/hosts"
"github.com/rancher/types/apis/management.cattle.io/v3"
)
func (f *factory) sshDialer(machine *v3.Machine) (Dialer, error) {
if machine.Status.NodeConfig == nil {
return nil, fmt.Errorf("waiting to provision %s", machine.Name)
}
host := &hosts.Host{
RKEConfigNode: *machine.Status.NodeConfig,
}
sshFactory, err := hosts.SSHFactory(host)
if err != nil {
return nil, err
}
return sshFactory, nil
}
func (f *factory) sshLocalDialer(machine *v3.Machine) (Dialer, error) {
if machine.Status.NodeConfig == nil {
return nil, fmt.Errorf("waiting to provision %s", machine.Name)
}
host := &hosts.Host{
RKEConfigNode: *machine.Status.NodeConfig,
}
sshFactory, err := hosts.LocalConnFactory(host)
if err != nil {
return nil, err
}
return sshFactory, nil
}