forked from ungleich-public/cdist
Merge branch 'master' into 'master'
__postgres_*: fix forgotten edge cases in delimited identifier escape See merge request ungleich-public/cdist!833
This commit is contained in:
commit
a518134bfa
2 changed files with 12 additions and 6 deletions
|
@ -43,10 +43,14 @@ if [ "$state_should" != "$state_is" ]; then
|
||||||
if [ -f "$__object/parameter/owner" ]; then
|
if [ -f "$__object/parameter/owner" ]; then
|
||||||
owner="-O \"$(cat "$__object/parameter/owner")\""
|
owner="-O \"$(cat "$__object/parameter/owner")\""
|
||||||
fi
|
fi
|
||||||
echo "su - '$postgres_user' -c \"createdb $owner \"$name\"\""
|
cat << EOF
|
||||||
|
su - '$postgres_user' -c "createdb $owner \"$name\""
|
||||||
|
EOF
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo "su - '$postgres_user' -c \"dropdb \"$name\"\""
|
cat << EOF
|
||||||
|
su - '$postgres_user' -c "dropdb \"$name\""
|
||||||
|
EOF
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -53,11 +53,13 @@ case "$state_should" in
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -n "$password" ] && password="PASSWORD '$password'"
|
[ -n "$password" ] && password="PASSWORD '$password'"
|
||||||
|
cat << EOF
|
||||||
cmd="CREATE ROLE \"$name\" WITH $password $booleans"
|
su - '$postgres_user' -c "psql postgres -wc 'CREATE ROLE \"$name\" WITH $password $booleans;'"
|
||||||
echo "su - '$postgres_user' -c \"psql postgres -wc \\\"$cmd\\\"\""
|
EOF
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo "su - '$postgres_user' -c \"dropuser \\\"$name\\\"\""
|
cat << EOF
|
||||||
|
su - '$postgres_user' -c "dropuser \"$name\""
|
||||||
|
EOF
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue