Compare commits
No commits in common. "931d62149f382fbe654054a7e195a875e057b4b0" and "cb6e92aa92fc8b917c2f4b1a60331185bcb1ed1b" have entirely different histories.
931d62149f
...
cb6e92aa92
1 changed files with 2 additions and 15 deletions
|
|
@ -43,22 +43,9 @@ SHORT_SHA="${SHA:0:12}"
|
|||
API="https://${PVE_TEST_HOST}:8006/api2/json"
|
||||
|
||||
api() {
|
||||
# Wrapper so that on non-2xx we print the PVE response body to stderr
|
||||
# before bubbling the failure — otherwise `--fail-with-body` output
|
||||
# gets swallowed by callers that pipe to /dev/null, and you're left
|
||||
# staring at "curl: (22)" with no idea which permission is missing.
|
||||
local body rc
|
||||
body=$(curl --silent --show-error --fail-with-body -k \
|
||||
curl --silent --show-error --fail-with-body -k \
|
||||
--header "Authorization: PVEAPIToken=${PVE_TEST_TOKEN}" \
|
||||
"$@" 2>&1)
|
||||
rc=$?
|
||||
if [[ $rc -ne 0 ]]; then
|
||||
echo "!! PVE API call failed (rc=$rc)" >&2
|
||||
echo "!! request: $*" >&2
|
||||
[[ -n "$body" ]] && echo "!! response: $body" >&2
|
||||
return $rc
|
||||
fi
|
||||
printf '%s' "$body"
|
||||
"$@"
|
||||
}
|
||||
|
||||
# PVE returns {"data": <payload>}; grab .data into a python expression.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue