forked from stevedomin/frenzy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.go
40 lines (35 loc) · 738 Bytes
/
node.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
39
40
package pkg
import (
"github.com/stevedomin/frenzy/pkg/communicators/ssh"
)
type NodeInfo struct {
ID string
Hostname string
Host string
Port string
}
type Node struct {
Communicator Communicator
ID string
Status string
Hostname string
Host string
Port string
Provider Provider
Provisioners []Provisioner
}
// TODO Change this
func (n *Node) GetCommunicator() Communicator {
if n.Communicator == nil {
// Private key path shouldn't be hardcoded that way...
n.Communicator = ssh.NewSSH(n.Host, n.Port, "./.frenzy/frenzy_insecure_key")
}
return n.Communicator
}
func (n *Node) TruncID() string {
if n.ID != "" {
return n.ID[:12]
} else {
return n.ID
}
}