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