Skip to content

Add verify-clone.sh: verify a template from the Proxmox host - #50

Merged
modem7 merged 7 commits into
masterfrom
verify-clone-wrapper
Oct 23, 2026
Merged

modem7 merged 7 commits into
masterfrom
verify-clone-wrapper

Conversation

@modem7

@modem7 modem7 commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

What

Adds verify-clone.sh, a host-side wrapper so verify-template.sh no longer has to be copied into a clone by hand.

./verify-clone.sh <template-vmid> [--profile ...] [--send-test-mail <addr>] [--vmid N] [--full [--storage S]] [--keep] [--timeout S] [--verify-timeout S]

Flow: qm clone (linked by default), qm start, wait on qm agent ping, cloud-init status --wait, then qm guest exec --pass-stdin 1 -- /bin/bash -s -- <args> with verify-template.sh on stdin (about 22 KB, limit 1 MiB). The guest output is printed in order and the exit code is returned. The clone is destroyed on exit, failure, Ctrl-C and SIGTERM unless --keep is given.

  • Refuses an existing VMID, a non-template, and never touches a VM it did not create (cleanup is armed only after qm clone succeeds).
  • With --send-test-mail, polls the guest's Postfix journal for status=sent (up to 60s). deferred or bounced is a FAIL.
  • Exit codes: 0 ok, 1 FAIL or clone/start error, 2 usage, 3 agent timeout, 4 cloud-init error, 5 guest command timeout, 130/143 signals.
  • README updated; --help follows the build-templates.sh style. verify-template.sh is unchanged.

Testing

bash -n and shellcheck are clean. Behaviour was checked against a mocked qm and pvesh: happy path, verify FAIL, --keep, existing VMID, agent timeout, clone failure, SIGINT and SIGTERM, mail sent, deferred and missing, plain-text qm output, jq fallback, bad arguments.

Not run on a real Proxmox host. Two things are assumed, not confirmed:

  • qm guest exec prints JSON like {"exitcode":0,"exited":1,"out-data":"..."} (not documented; plain text is also handled).
  • Ubuntu logs Postfix deliveries under postfix@-.service; both postfix and postfix@* units are queried.

modem7 and others added 4 commits October 22, 2026 19:50
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
… the host

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@modem7
modem7 merged commit 5b67a0d into master Oct 23, 2026
1 check passed
@modem7
modem7 deleted the verify-clone-wrapper branch October 23, 2026 10:11
modem7 added a commit that referenced this pull request Oct 23, 2026
Host-side wrapper: clones a template, boots the clone, runs verify-template.sh inside it through the guest agent, returns its exit code and removes the clone. Also: verify-template.sh skips shell and sudo checks for a root login, and refuses a script that is not verify-template.sh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant