Add 'save': the closing step for any change

save = snapshot --update + start, and falls back to a first-time snapshot
when no baseline exists yet. On the qemu platform it folds the working
overlays into the base images and brings the lab back up; on proxmox it
re-templates.

Documented as the rule it is: every deliberate change to the lab ends with
save, so reset always returns to the state you meant to freeze.
This commit is contained in:
2026-10-24 02:13:18 -04:00
parent 9ba0ca98ac
commit b9bc0eb079
6 changed files with 38 additions and 4 deletions
+25
View File
@@ -53,3 +53,28 @@ cmd_reset() {
printf '\n'
ok "laboratory reset — previous state discarded"
}
# The closing step of every change: freeze the current state into the
# baseline, then bring the lab back up. Falls back to a first-time snapshot
# when no baseline exists yet.
cmd_save() {
local name need_full=0
if declare -F backend_has_baseline >/dev/null; then
for name in "${VM_NAMES[@]}"; do
backend_has_baseline "$name" || need_full=1
done
else
need_full=1
fi
if (( need_full )); then
cmd_snapshot
else
cmd_snapshot --update
fi
step "start"
_start_lab
}
+2
View File
@@ -26,6 +26,7 @@ Commands:
provision run the role stages (--role NAME for a single VM)
web assemble the site; --sync publishes it to FS01
snapshot freeze a clean baseline
save snapshot --update then start (the closing step)
reset revert to the baseline and start
up, down start / stop the VMs
status VM table
@@ -95,6 +96,7 @@ case $cmd in
vnc) cmd_vnc "$@" ;;
provision) cmd_provision "$@" ;;
snapshot) cmd_snapshot "$@" ;;
save) cmd_save "$@" ;;
reset) cmd_reset "$@" ;;
doctor) cmd_doctor "$@" ;;
kali) cmd_kali "$@" ;;