Fix mktemp template so deploy-managed-agent.sh runs on Linux

GNU mktemp wants 3+ X's in a -t template. The bare `mktemp -t skillcache`
and `mktemp -t skill` calls worked on macOS but crash on Linux before
the script does anything. test-cookbooks.sh fails the same way for all
5 cookbooks because it calls deploy --dry-run.

Adding .XXXXXX is portable: GNU expands the X's, BSD treats them as
prefix. Confirmed on Ubuntu 24.04 / coreutils 9.4: test-cookbooks goes
0/5 -> 5/5.
This commit is contained in:
Akhilesh Arora 2026-05-16 20:26:41 +02:00
parent 4d55f53962
commit bf6aea18bb
No known key found for this signature in database
GPG key ID: 564A6143F12D4670

View file

@ -64,7 +64,7 @@ json.dump(yaml.safe_load(t), sys.stdout)
' "$1"
}
SKILL_CACHE_FILE="$(mktemp -t skillcache)"
SKILL_CACHE_FILE="$(mktemp -t skillcache.XXXXXX)"
trap 'rm -f "$SKILL_CACHE_FILE"' EXIT
upload_skill() {
local path="$1" key cached
@ -77,7 +77,7 @@ upload_skill() {
printf '%s' "$cached"; return
fi
local resp id zip
zip="$(mktemp -t skill).zip"
zip="$(mktemp -t skill.XXXXXX).zip"
(cd "$(dirname "$path")" && zip -qr "$zip" "$(basename "$path")")
# /v1/skills uses its own beta header and multipart, not the managed-agents JSON path
resp=$(curl -sS "$API/v1/skills" \