[type/__postgres_conf] Add psql_conf_cmp function to state explorer
This commit is contained in:
parent
92b8942a8c
commit
2ccc03fef1
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue