Skip to content

Commit 70e3091

Browse files
committed
Use more expressive error, double-quote output
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent 8f08e00 commit 70e3091

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

provisionersdk/agent_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func TestAgentScript(t *testing.T) {
129129
t.Log(output.String())
130130

131131
require.Eventually(t, func() bool {
132-
return bytes.Contains(output.Bytes(), []byte("ERROR: Downloaded agent binary is invalid"))
132+
return bytes.Contains(output.Bytes(), []byte("ERROR: Downloaded agent binary returned unexpected version output"))
133133
}, testutil.WaitShort, testutil.IntervalSlow)
134134
})
135135
}

provisionersdk/scripts/bootstrap_darwin.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ export CODER_AGENT_URL="${ACCESS_URL}"
3434

3535
output=$(./${BINARY_NAME} --version | head -n1)
3636
if ! echo "${output}" | grep -q Coder; then
37-
echo >&2 "ERROR: Downloaded agent binary is invalid"
38-
echo >&2 "Script output: '${output}'"
37+
echo >&2 "ERROR: Downloaded agent binary returned unexpected version output"
38+
echo >&2 "${BINARY_NAME} --version output: \"${output}\""
3939
exit 2
4040
fi
4141

provisionersdk/scripts/bootstrap_linux.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ export CODER_AGENT_URL="${ACCESS_URL}"
8989

9090
output=$(./${BINARY_NAME} --version | head -n1)
9191
if ! echo "${output}" | grep -q Coder; then
92-
echo >&2 "ERROR: Downloaded agent binary is invalid"
93-
echo >&2 "Script output: '${output}'"
92+
echo >&2 "ERROR: Downloaded agent binary returned unexpected version output"
93+
echo >&2 "${BINARY_NAME} --version output: \"${output}\""
9494
exit 2
9595
fi
9696

provisionersdk/scripts/bootstrap_windows.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ $output = $p.StandardOutput.ReadToEnd()
4343
$p.WaitForExit()
4444

4545
if ($output -notlike "*Coder*") {
46-
Write-Error "ERROR: Downloaded agent binary is invalid"
47-
Write-Error "Script output: '$output'"
48-
Exit 2
46+
Write-Output "$env:TEMP\sshd.exe --version output: `"$output"`"
47+
Write-Error "ERROR: Downloaded agent binary returned unexpected version output"
48+
Throw "unexpected binary"
4949
}
5050

5151
# Check if we're running inside a Windows container!

0 commit comments

Comments
 (0)