fix: always register node, remove broken skip logic and stray brace
This commit is contained in:
parent
6f5c281089
commit
50ba28c2f9
1 changed files with 33 additions and 47 deletions
|
|
@ -83,20 +83,7 @@ func InstallNode(node state.Node, apiToken, apiHost, labels string) error {
|
||||||
fmt.Printf("[%s] Configuring NGINX module...\n", node.Name)
|
fmt.Printf("[%s] Configuring NGINX module...\n", node.Name)
|
||||||
exec.Command("bash", filepath.Join(DeployTo, "pick-module.sh")).Run()
|
exec.Command("bash", filepath.Join(DeployTo, "pick-module.sh")).Run()
|
||||||
|
|
||||||
// 6. Register node — skip if this node was previously deployed
|
// 6. Register node
|
||||||
existingState, _ := state.Load()
|
|
||||||
alreadyRegistered := false
|
|
||||||
if existingState != nil {
|
|
||||||
for _, n := range existingState.Nodes {
|
|
||||||
if n.Name == node.Name {
|
|
||||||
alreadyRegistered = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if alreadyRegistered {
|
|
||||||
fmt.Printf("[%s] Already registered, skipping.\n", node.Name)
|
|
||||||
} else {
|
|
||||||
fmt.Printf("[%s] Registering node (this may take 30-60s)...\n", node.Name)
|
fmt.Printf("[%s] Registering node (this may take 30-60s)...\n", node.Name)
|
||||||
registerCmd := exec.Command(filepath.Join(DeployTo, "register-node"),
|
registerCmd := exec.Command(filepath.Join(DeployTo, "register-node"),
|
||||||
"job:register",
|
"job:register",
|
||||||
|
|
@ -132,7 +119,6 @@ func InstallNode(node state.Node, apiToken, apiHost, labels string) error {
|
||||||
data, _ := os.ReadFile(filepath.Join(DeployTo, "register.log"))
|
data, _ := os.ReadFile(filepath.Join(DeployTo, "register.log"))
|
||||||
return fmt.Errorf("register: %w\n%s", regErr, string(data))
|
return fmt.Errorf("register: %w\n%s", regErr, string(data))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 8. Move /opt/wallarm → /opt/fw/{name}/wallarm
|
// 8. Move /opt/wallarm → /opt/fw/{name}/wallarm
|
||||||
os.MkdirAll(filepath.Join(BaseDir, node.Name), 0755)
|
os.MkdirAll(filepath.Join(BaseDir, node.Name), 0755)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue