|
|
@ -253,8 +253,6 @@ func get(envInfo *cmds.Agent) (*config.Node, error) { |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
hostnameCheck(nodeName) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nodeCertFile := filepath.Join(envInfo.DataDir, "token-node.crt") |
|
|
|
nodeCertFile := filepath.Join(envInfo.DataDir, "token-node.crt") |
|
|
|
nodeKeyFile := filepath.Join(envInfo.DataDir, "token-node.key") |
|
|
|
nodeKeyFile := filepath.Join(envInfo.DataDir, "token-node.key") |
|
|
|
nodePasswordFile := filepath.Join(envInfo.DataDir, "node-password.txt") |
|
|
|
nodePasswordFile := filepath.Join(envInfo.DataDir, "node-password.txt") |
|
|
@ -351,13 +349,18 @@ func getConfig(info *clientaccess.Info) (*config.Control, error) { |
|
|
|
return controlControl, json.Unmarshal(data, controlControl) |
|
|
|
return controlControl, json.Unmarshal(data, controlControl) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func hostnameCheck(hostname string) { |
|
|
|
func HostnameCheck(cfg cmds.Agent) error { |
|
|
|
for { |
|
|
|
hostname, _, err := getHostnameAndIP(cfg) |
|
|
|
_, err := sysnet.LookupHost(hostname) |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for i := 0; i < 5; i++ { |
|
|
|
|
|
|
|
_, err = sysnet.LookupHost(hostname) |
|
|
|
if err == nil { |
|
|
|
if err == nil { |
|
|
|
break |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
logrus.Infof("Waiting for hostname %s to be resolvable: %v", hostname, err) |
|
|
|
logrus.Infof("Waiting for hostname %s to be resolvable: %v", hostname, err) |
|
|
|
time.Sleep(2 * time.Second) |
|
|
|
time.Sleep(time.Second * 3) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return fmt.Errorf("Timed out waiting for hostname %s to be resolvable: %v", hostname, err) |
|
|
|
} |
|
|
|
} |
|
|
|