mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
A templated script is opaque to every tool that reads shell. shellcheck parses Jinja as syntax errors, the repository's own .sh guards skip the file because it is not a .sh, and nothing can execute it to test it: what runs on the host never exists in the repository, so a defect in the rendered half is found by deploying it. The lint reports any *.sh.j2 under roles and points at the static slot sys-service already resolves, files/shell/script.sh, with the values passed as ExecStart arguments or Environment entries the way this repository's python scripts already take them. None of the seven templates present meets the bar the marker is for, which is a script whose shape is generated rather than its values. Each is grandfathered with a marker naming what it interpolates, because converting a deployed script to argv changes what runs on the host. The guard exists to stop the next one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
18 lines
542 B
Django/Jinja
18 lines
542 B
Django/Jinja
#!/bin/bash
|
|
{# nocheck: shell-template grandfathered, values only: bot token, chat id and the curl filter's timeout #}
|
|
set -u
|
|
|
|
# Make the instance text human readable again (reverse systemd escaping)
|
|
friendly="$(systemd-escape --unescape "$1")"
|
|
|
|
if command -v hostname &>/dev/null; then
|
|
host=$(hostname)
|
|
else
|
|
host="$HOSTNAME"
|
|
fi
|
|
|
|
{{ 30 | curl }} -X POST \
|
|
"https://api.telegram.org/bot{{ TELEGRAM_BOT_TOKEN }}/sendMessage" \
|
|
-d chat_id="{{ TELEGRAM_CHAT_ID }}" \
|
|
--data-urlencode text="service ${friendly//\//-} on ${host} failed"
|