fix: patch setup.sh env.list sed lines to be non-fatal, kill port with ss

This commit is contained in:
admin 2026-08-01 18:36:11 +00:00
parent bc66018af3
commit 0922102226

View file

@ -61,17 +61,15 @@ func InstallNode(node state.Node, apiToken, apiHost, labels string) error {
return fmt.Errorf("extract: %w\n%s", err, string(out)) return fmt.Errorf("extract: %w\n%s", err, string(out))
} }
// Run setup.sh with env.list protection // 5. Patch setup.sh: make env.list sed commands non-fatal (file gets deleted during nginx test)
fmt.Printf("[%s] Running setup...\n", node.Name)
setupPath := filepath.Join(DeployTo, "setup.sh") setupPath := filepath.Join(DeployTo, "setup.sh")
// Wrapper: ensure env.list exists before any sed commands touch it exec.Command("sed", "-i",
wrapper := fmt.Sprintf(`#!/bin/bash `s|\(/opt/wallarm/env.list\)|\1 2>/dev/null || true|g`,
trap 'touch %s/env.list 2>/dev/null' DEBUG setupPath).Run()
bash %s "$@"
`, DeployTo, setupPath) // 6. Run setup.sh
wrapperPath := filepath.Join(DeployTo, "run-setup.sh") fmt.Printf("[%s] Running setup...\n", node.Name)
os.WriteFile(wrapperPath, []byte(wrapper), 0755) cmd = exec.Command("bash", setupPath,
cmd = exec.Command("bash", wrapperPath,
"--batch", "--token", apiToken, "--cloud", cloudFromHost(apiHost), "--batch", "--token", apiToken, "--cloud", cloudFromHost(apiHost),
"--custom-ngx-build", "--custom-ngx-build",
) )