Files
ocf-managed-container/refactored/managed-container.d/container.sh
T
Lyncoln ec2077f979 Freeze lab-tested PostgreSQL plugin engine
Extract PostgreSQL, Podman runtime and systemd lifecycle adapters while preserving existing lifecycle and scoring behavior. Update RPM layout and add guarded operator-run lab harnesses.

Record successful manual stop/start, promotion, demotion and rewind-only rejoin with pinned installed hashes. The unfenced lab does not validate automatic failover, Pacemaker-managed transitions or divergent-data rewind.

Validation: 103 offline tests, original-function differential checks, checksum manifest and whitespace checks passed.
2026-09-13 01:57:04 -04:00

55 lines
972 B
Bash

# Sourced by managed-container; uses the shared OCF and parameter environment.
service_uid()
{
id -u "${SERVICE_USER}"
}
service_home()
{
getent passwd "${SERVICE_USER}" | cut -d: -f6
}
as_service_user()
{
local uid home
uid="$(id -u "$SERVICE_USER")" || return 1
home="$(getent passwd "$SERVICE_USER" | cut -d: -f6)" || return 1
runuser -u "$SERVICE_USER" -- \
sh -c '
home="$1"
runtime="$2"
shift 2
cd "$home" || exit 1
export HOME="$home"
export XDG_RUNTIME_DIR="$runtime"
exec "$@"
' sh \
"$home" \
"/run/user/$uid" \
"$@"
}
service_running()
{
mc_lifecycle_running "${SERVICE_NAME}"
}
container_running()
{
local state
state="$(
mc_runtime_inspect \
--format '{{.State.Running}}' \
"${CONTAINER_NAME}" 2>/dev/null
)" || return 1
[ "${state}" = "true" ]
}