# Engine API 1. Selection is an allowlist of packaged implementations, never a # filename, shell fragment or a plugin downloaded from cluster configuration. mc_engine_load() { local plugin hook if [ "${OCF_RESKEY_application:-postgresql}" != postgresql ] || [ "${OCF_RESKEY_container_runtime:-podman}" != podman ] || [ "${OCF_RESKEY_lifecycle_manager:-systemd}" != systemd ]; then ocf_exit_reason "Supported plugin combination: application=postgresql container_runtime=podman lifecycle_manager=systemd" return "${OCF_ERR_CONFIGURED}" fi unset MC_RUNTIME_API MC_LIFECYCLE_API MC_APPLICATION_API for plugin in runtimes/podman lifecycles/systemd applications/postgresql/plugin; do if ! . "${MC_MODULE_DIR}/${plugin}.sh"; then ocf_exit_reason "Unable to load resource-agent module ${MC_MODULE_DIR}/${plugin}.sh" return "${OCF_ERR_CONFIGURED}" fi done if [ "${MC_RUNTIME_API:-}" != 1 ] || [ "${MC_LIFECYCLE_API:-}" != 1 ] || [ "${MC_APPLICATION_API:-}" != 1 ]; then ocf_exit_reason "Incompatible plugin interface; API 1 required" return "${OCF_ERR_CONFIGURED}" fi for hook in mc_runtime_exec mc_runtime_exec_bounded mc_runtime_inspect mc_runtime_info \ mc_lifecycle_start mc_lifecycle_stop mc_lifecycle_running mc_lifecycle_cat \ mc_application_monitor mc_application_standby_score mc_application_validate \ mc_application_metadata mc_application_notify mc_application_action; do if ! declare -F "${hook}" >/dev/null; then ocf_exit_reason "Required plugin hook is missing: ${hook}" return "${OCF_ERR_CONFIGURED}" fi done } mc_engine_metadata() { # Metadata discovery works without configured resource instance attributes. # Capture the plugin's status before transforming XML; avoid a pipeline # masking a metadata failure. No runtime/service/cluster access is required. local metadata metadata="$(mc_application_metadata)" || return "$?" printf '%s\n' "${metadata}" | sed '/<\/parameters>/i\ \ Packaged application plugin. Only postgresql is supported.\ Application plugin\ \ \ \ Packaged runtime adapter. Only podman is supported.\ Container runtime\ \ \ \ Container lifecycle owner. Only systemd with the existing user service is supported.\ Lifecycle manager\ \ ' }