From e03907882c7226a126f5cc0c7a9f54f2c6818841 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 11 Aug 2026 19:49:02 +0000 Subject: [PATCH] Auto-detect the Asterisk container/dir in the PSTN test checklist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit $CONTAINER/$EA_DIR only lived in the shell session where they were typed by hand — a new terminal or enough time between test steps left them empty, and an empty $CONTAINER silently collapsed "docker exec -it $CONTAINER asterisk -rx ..." into "docker exec -it asterisk -rx ...", failing with "No such container: asterisk" instead of an obviously-unset-variable error. Confirmed live. Replaced the manual pick with a docker ps auto-detect so a stale/forgotten variable can't silently break every command in the checklist. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01H4k6J1qXXyYxhGEgnJaMvn --- docs/pstn-sms-test-checklist.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/docs/pstn-sms-test-checklist.md b/docs/pstn-sms-test-checklist.md index e13026a..b481957 100644 --- a/docs/pstn-sms-test-checklist.md +++ b/docs/pstn-sms-test-checklist.md @@ -14,21 +14,25 @@ kill-switch trip). ## 0. Before you start -Confirm which layout this box uses — commands below need the right -container name and directory: +`$CONTAINER`/`$EA_DIR` only live in the shell session where you set them — +a new terminal, a reboot, or just enough time passing between test steps +leaves them empty again, and an empty `$CONTAINER` silently turns +`docker exec -it $CONTAINER asterisk -rx ...` into `docker exec -it +asterisk -rx ...`, which fails with "No such container: asterisk" (there's +no container literally named that — it's `easy-asterisk` or +`easy-asterisk-do`). Auto-detect instead of typing it by hand, so a stale +or forgotten variable can't silently break every command below: ```bash -docker ps --format '{{.Names}}' | grep -i easy-asterisk -# easy-asterisk -> ~/docker/asterisk -# easy-asterisk-do -> ~/docker/asterisk-digital-ocean (pre-merge droplet) +CONTAINER="$(docker ps --format '{{.Names}}' | grep -m1 -E '^easy-asterisk(-do)?$')" +EA_DIR=~/docker/asterisk; [ -d ~/docker/asterisk-digital-ocean ] && EA_DIR=~/docker/asterisk-digital-ocean +echo "Container: $CONTAINER Dir: $EA_DIR" ``` -Set these once and reuse them in every command below: - -```bash -CONTAINER=easy-asterisk # or easy-asterisk-do -EA_DIR=~/docker/asterisk # or ~/docker/asterisk-digital-ocean -``` +If `$CONTAINER` prints empty, the container isn't running at all — check +`docker compose -f $EA_DIR/docker-compose.yml ps` before anything else. +Re-run this block at the start of every new terminal session, not just +once — it's cheap and removes the whole class of failure above. Check the three services this checklist covers are actually installed: