diff --git a/cdist/conf/type/__postgres_conf/explorer/state b/cdist/conf/type/__postgres_conf/explorer/state index 1a58751a..be881be6 100644 --- a/cdist/conf/type/__postgres_conf/explorer/state +++ b/cdist/conf/type/__postgres_conf/explorer/state @@ -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