forked from ungleich-public/cdist
Add --template flag to __postgres_database type
This commit is contained in:
parent
d53077f4e8
commit
c3f924d350
3 changed files with 11 additions and 1 deletions
|
@ -44,6 +44,11 @@ if [ "$state_should" != "$state_is" ]; then
|
|||
owner="-O \"$(cat "$__object/parameter/owner")\""
|
||||
fi
|
||||
|
||||
template=""
|
||||
if [ -f "$__object/parameter/template" ]; then
|
||||
template="--template \"$(cat "$__object/parameter/template")\""
|
||||
fi
|
||||
|
||||
encoding=""
|
||||
if [ -f "$__object/parameter/encoding" ]; then
|
||||
encoding="--encoding \"$(cat "$__object/parameter/encoding")\""
|
||||
|
@ -60,7 +65,7 @@ if [ "$state_should" != "$state_is" ]; then
|
|||
fi
|
||||
|
||||
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
|
||||
;;
|
||||
absent)
|
||||
|
|
|
@ -28,6 +28,10 @@ lc-collate
|
|||
lc-ctype
|
||||
Specifies the LC_CTYPE setting to be used in this database.
|
||||
|
||||
template
|
||||
Specifies the template database from which to build this database.
|
||||
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
|
||||
|
|
|
@ -3,3 +3,4 @@ owner
|
|||
encoding
|
||||
lc-collate
|
||||
lc-ctype
|
||||
template
|
||||
|
|
Loading…
Reference in a new issue