Skip to content

Commit 7b5b92f

Browse files
committed
azure: fix bootstrap extension command error path for bash
On some distros like for example Flatcar, bootstrap extension command is executed using bash, instead of using e.g. dash on Ubuntu, which does not allow 'return' calls from the shell, so when currently provisioning fails, user gets the following confusing error message: /bin/sh: line 1: return: can only return' from a function or sourced script To fix this, let's use 'exit' instead which should be more universal. Refs #2271 Signed-off-by: Mateusz Gozdek <[email protected]>
1 parent c536cf1 commit 7b5b92f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

azure/defaults.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const (
103103

104104
var (
105105
// LinuxBootstrapExtensionCommand is the command the VM bootstrap extension will execute to verify Linux nodes bootstrap completes successfully.
106-
LinuxBootstrapExtensionCommand = fmt.Sprintf("for i in $(seq 1 %d); do test -f %s && break; if [ $i -eq %d ]; then return 1; else sleep %d; fi; done", bootstrapExtensionRetries, bootstrapSentinelFile, bootstrapExtensionRetries, bootstrapExtensionSleep)
106+
LinuxBootstrapExtensionCommand = fmt.Sprintf("for i in $(seq 1 %d); do test -f %s && break; if [ $i -eq %d ]; then exit 1; else sleep %d; fi; done", bootstrapExtensionRetries, bootstrapSentinelFile, bootstrapExtensionRetries, bootstrapExtensionSleep)
107107
// WindowsBootstrapExtensionCommand is the command the VM bootstrap extension will execute to verify Windows nodes bootstrap completes successfully.
108108
WindowsBootstrapExtensionCommand = fmt.Sprintf("powershell.exe -Command \"for ($i = 0; $i -lt %d; $i++) {if (Test-Path '%s') {exit 0} else {Start-Sleep -Seconds %d}} exit -2\"",
109109
bootstrapExtensionRetries, bootstrapSentinelFile, bootstrapExtensionSleep)

0 commit comments

Comments
 (0)