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