forked from ungleich-public/cdist
[type/__postgres_role] Always set psql -q
This commit is contained in:
parent
1180f13ed6
commit
99d82fd0d5
2 changed files with 4 additions and 4 deletions
|
@ -37,7 +37,7 @@ rolename=${__object_id:?}
|
||||||
|
|
||||||
psql_query() {
|
psql_query() {
|
||||||
su -l "${postgres_user}" -c "$(
|
su -l "${postgres_user}" -c "$(
|
||||||
printf "psql -F '\034' -R '\036' -wAc '%s'" \
|
printf "psql -q -F '\034' -R '\036' -wAc '%s'" \
|
||||||
"$(printf %s "$*" | sed "s/'/'\\\\''/g")"
|
"$(printf %s "$*" | sed "s/'/'\\\\''/g")"
|
||||||
)"
|
)"
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ password_check_login() (
|
||||||
PGPASSWORD=$(cat "${__object:?}/parameter/password"; printf .)
|
PGPASSWORD=$(cat "${__object:?}/parameter/password"; printf .)
|
||||||
PGPASSWORD=${PGPASSWORD%?.}
|
PGPASSWORD=${PGPASSWORD%?.}
|
||||||
export PGPASSWORD
|
export PGPASSWORD
|
||||||
psql -w -h localhost -U "${rolename}" template1 -c '\q' >/dev/null 2>&1
|
psql -q -w -h localhost -U "${rolename}" template1 -c '\q' >/dev/null 2>&1
|
||||||
)
|
)
|
||||||
|
|
||||||
role_properties=$(
|
role_properties=$(
|
||||||
|
|
|
@ -54,7 +54,7 @@ fi
|
||||||
psql_query() {
|
psql_query() {
|
||||||
printf 'su -l %s -c %s\n' \
|
printf 'su -l %s -c %s\n' \
|
||||||
"$(quote "${postgres_user}")" \
|
"$(quote "${postgres_user}")" \
|
||||||
"$(quote "psql postgres -wc $(quote "$1")")"
|
"$(quote "psql postgres -q -w -c $(quote "$1")")"
|
||||||
}
|
}
|
||||||
|
|
||||||
psql_set_password() {
|
psql_set_password() {
|
||||||
|
@ -63,7 +63,7 @@ psql_set_password() {
|
||||||
then
|
then
|
||||||
cat <<-EOF
|
cat <<-EOF
|
||||||
exec 3< "\${__object:?}/parameter/password"
|
exec 3< "\${__object:?}/parameter/password"
|
||||||
su -l '${postgres_user}' -c 'psql -q postgres -w' <<'SQL'
|
su -l '${postgres_user}' -c 'psql -q -w postgres' <<'SQL'
|
||||||
\set HISTFILE /dev/null
|
\set HISTFILE /dev/null
|
||||||
\set pw \`cat <&3\`
|
\set pw \`cat <&3\`
|
||||||
ALTER ROLE "${rolename}" WITH PASSWORD :'pw';
|
ALTER ROLE "${rolename}" WITH PASSWORD :'pw';
|
||||||
|
|
Loading…
Reference in a new issue