chore: initial import from KNEL/PFVCluster@041d311 [#769]
Split per O&M lane work order. Full history: KNEL/PFVCluster. https://projects.knownelement.com/issues/769#note-4152
This commit is contained in:
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# zone-snapshot.sh — refresh the git SoR snapshot of the Technitium zone
|
||||
# store [#630][#728]
|
||||
#
|
||||
# Pulls the binary DZ zone files from netinfra-01 (the replication primary)
|
||||
# into netinfra/dns/technitium/zones/ via the remote-dns.sh chokepoint, then
|
||||
# shows which snapshot files changed.
|
||||
#
|
||||
# RULE (founder, 2026-09-02): run this after EVERY Technitium record change
|
||||
# and commit the refreshed snapshots in the same session, so the git SoR
|
||||
# never goes stale. netinfra/dns/drift-check.sh verifies the result; the
|
||||
# pre-push rule audit fails on a stale questions file and drift-check is the
|
||||
# DNS counterpart: green before you push any DNS-adjacent change.
|
||||
#
|
||||
# Usage:
|
||||
# zone-snapshot.sh refresh snapshots from the primary
|
||||
# zone-snapshot.sh --check verify only (delegates to drift-check.sh)
|
||||
#
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # netinfra/dns/technitium
|
||||
REPO="$(cd "$HERE/../../.." && pwd)"
|
||||
REMOTE_DNS="$HERE/../../dns-cluster-setup/remote-dns.sh"
|
||||
ZONES_DIR="$HERE/zones"
|
||||
REMOTE_ZONE_DIR="/home/localuser/services/technitium/config/zones"
|
||||
|
||||
if [ "${1:-}" = "--check" ]; then
|
||||
exec bash "$HERE/../drift-check.sh"
|
||||
fi
|
||||
|
||||
tmp="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmp"' EXIT
|
||||
|
||||
echo "Fetching zone store from netinfra-01 (primary)..."
|
||||
bash "$REMOTE_DNS" netinfra01-root "cd '$REMOTE_ZONE_DIR' && tar cf - *.zone" > "$tmp/zones.tar"
|
||||
|
||||
# Validate the archive before touching the tracked tree.
|
||||
tar -tf "$tmp/zones.tar" >/dev/null
|
||||
|
||||
mkdir -p "$ZONES_DIR"
|
||||
find "$ZONES_DIR" -maxdepth 1 -name '*.zone' -delete
|
||||
tar -xf "$tmp/zones.tar" -C "$ZONES_DIR"
|
||||
|
||||
count="$(find "$ZONES_DIR" -maxdepth 1 -name '*.zone' | wc -l)"
|
||||
echo "Snapshotted $count zone files into ${ZONES_DIR#"$REPO"/}"
|
||||
|
||||
echo "Changed snapshot files (git):"
|
||||
changed="$(git -C "$REPO" status --porcelain -- "$ZONES_DIR")"
|
||||
if [ -n "$changed" ]; then
|
||||
printf '%s\n' "$changed" | sed "s|^$REPO/||" | head -20
|
||||
printf '%s\n' "$changed" | wc -l | xargs -I{} echo "{} files changed — commit these in the same session (DNS sync rule)"
|
||||
else
|
||||
echo " (none — snapshots were already current)"
|
||||
fi
|
||||
|
||||
echo "Verify with: netinfra/dns/drift-check.sh"
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user