49 lines
1.5 KiB
Bash
Executable File
49 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [ "${OPENVOX_RECREATE_SMOKE:-}" != "1" ]; then
|
|
echo "SKIP: set OPENVOX_RECREATE_SMOKE=1 to run the destructive openvoxserver recreate smoke." >&2
|
|
exit 64
|
|
fi
|
|
|
|
SUDO="${SUDO:-sudo}"
|
|
REPO="/etc/puppetlabs/code/environments/production"
|
|
CORE_SSH_COMMAND_FRAGMENT=".puppet-deploy-key"
|
|
|
|
if ! $SUDO systemctl cat openvoxserver >/dev/null 2>&1; then
|
|
echo "SKIP: systemctl cat openvoxserver failed; refusing to remove a container without a verified systemd recreate path." >&2
|
|
exit 65
|
|
fi
|
|
|
|
before="$($SUDO podman exec openvoxserver git -C "$REPO" rev-parse --short HEAD)"
|
|
echo "Before recreate: $before"
|
|
|
|
$SUDO systemctl stop openvoxserver
|
|
$SUDO podman rm openvoxserver 2>/dev/null || true
|
|
$SUDO systemctl start openvoxserver
|
|
|
|
sleep 50
|
|
|
|
$SUDO systemctl start puppet-deploy.service
|
|
sleep 5
|
|
|
|
$SUDO systemctl status puppet-deploy.service --no-pager -l
|
|
|
|
after="$($SUDO podman exec openvoxserver git -C "$REPO" rev-parse --short origin/master)"
|
|
echo "After recreate origin/master: $after"
|
|
|
|
$SUDO test -d /opt/puppet/code/environments/production/site-modules/profile/manifests
|
|
|
|
core_ssh="$($SUDO podman exec openvoxserver git -C "$REPO" config --get core.sshCommand)"
|
|
case "$core_ssh" in
|
|
*"$CORE_SSH_COMMAND_FRAGMENT"*) ;;
|
|
*)
|
|
echo "FAIL: core.sshCommand does not reference the persisted deploy key." >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
$SUDO podman exec openvoxserver git -C "$REPO" status --short --branch
|
|
|
|
echo "PASS: openvoxserver recreate smoke completed without git safety or deploy-key failure."
|