[type/__postgres_conf] Reverse state logic (decide based on source first)

This commit is contained in:
Dennis Camera 2021-04-15 15:01:38 +02:00
parent bef1433ba3
commit 686e4f0f2d

View file

@ -200,23 +200,24 @@ psql_exec 'SELECT 1' >/dev/null || {
exit 1 exit 1
} }
if psql_conf_cmp "${conf_name}" "$(cat "${__object:?}/parameter/value")" case $(psql_conf_source "${conf_name}")
then in
echo present
else
case $(psql_conf_source "${conf_name}")
in
('') ('')
# invalid configuration parameter printf 'Invalid configuration parameter: %s\n' "${conf_name}" >&2
# (error message was already printed by SHOW command above.
# Yes, it's a hack)
exit 1 exit 1
;; ;;
(default) (default)
echo absent echo absent
;; ;;
(*) (*)
if ! test -f "${__object:?}/parameter/value"
then
echo present
elif psql_conf_cmp "${conf_name}" "$(cat "${__object:?}/parameter/value")"
then
echo present
else
echo different echo different
fi
;; ;;
esac esac
fi