[type/__postgres_conf] Add psql_conf_cmp function to state explorer

This commit is contained in:
Dennis Camera 2021-04-15 09:02:40 +02:00
parent 92b8942a8c
commit 2ccc03fef1

View file

@ -27,12 +27,16 @@ psql_exec() {
su - "${postgres_user}" -c "psql postgres -twAc $(quote "$*")"
}
psql_conf_cmp() {
test "$(psql_exec "SHOW $1")" = "$2"
}
psql_exec 'SELECT 1' >/dev/null || {
echo 'Connection to PostgreSQL server failed' >&2
exit 1
}
if psql_exec "SHOW ${conf_name}" | cmp -s "${__object:?}/parameter/value" -
if psql_conf_cmp "${conf_name}" "$(cat "${__object:?}/parameter/value")"
then
echo present
else