Add --template flag to __postgres_database type

This commit is contained in:
fnux 2020-04-14 10:23:08 +02:00
parent d53077f4e8
commit c3f924d350
3 changed files with 11 additions and 1 deletions

View file

@ -44,6 +44,11 @@ if [ "$state_should" != "$state_is" ]; then
owner="-O \"$(cat "$__object/parameter/owner")\"" owner="-O \"$(cat "$__object/parameter/owner")\""
fi fi
template=""
if [ -f "$__object/parameter/template" ]; then
template="--template \"$(cat "$__object/parameter/template")\""
fi
encoding="" encoding=""
if [ -f "$__object/parameter/encoding" ]; then if [ -f "$__object/parameter/encoding" ]; then
encoding="--encoding \"$(cat "$__object/parameter/encoding")\"" encoding="--encoding \"$(cat "$__object/parameter/encoding")\""
@ -60,7 +65,7 @@ if [ "$state_should" != "$state_is" ]; then
fi fi
cat << EOF cat << EOF
su - '$postgres_user' -c "createdb $owner \"$name\" $encoding $lc_collate $lc_ctype" su - '$postgres_user' -c "createdb $owner \"$name\" $template $encoding $lc_collate $lc_ctype"
EOF EOF
;; ;;
absent) absent)

View file

@ -28,6 +28,10 @@ lc-collate
lc-ctype lc-ctype
Specifies the LC_CTYPE setting to be used in this database. Specifies the LC_CTYPE setting to be used in this database.
template
Specifies the template database from which to build this database.
EXAMPLES EXAMPLES
-------- --------

View file

@ -3,3 +3,4 @@ owner
encoding encoding
lc-collate lc-collate
lc-ctype lc-ctype
template