forked from ungleich-public/cdist
Merge branch 'postgres-database-args' into 'master'
Add --template, --encoding, --lc-collate, --lc-support to __postgres_database type See merge request ungleich-public/cdist!859
This commit is contained in:
commit
6ec3274598
3 changed files with 40 additions and 3 deletions
cdist/conf/type/__postgres_database
|
@ -43,8 +43,29 @@ 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
|
||||||
|
|
||||||
|
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")\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
lc_collate=""
|
||||||
|
if [ -f "$__object/parameter/lc-collate" ]; then
|
||||||
|
lc_collate="--lc-collate \"$(cat "$__object/parameter/lc-collate")\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
lc_ctype=""
|
||||||
|
if [ -f "$__object/parameter/lc-ctype" ]; then
|
||||||
|
lc_ctype="--lc-ctype \"$(cat "$__object/parameter/lc-ctype")\""
|
||||||
|
fi
|
||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
su - '$postgres_user' -c "createdb $owner \"$name\""
|
su - '$postgres_user' -c "createdb $owner \"$name\" $template $encoding $lc_collate $lc_ctype"
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
|
|
|
@ -14,10 +14,22 @@ This cdist type allows you to create or drop postgres databases.
|
||||||
OPTIONAL PARAMETERS
|
OPTIONAL PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
state
|
state
|
||||||
either 'present' or 'absent', defaults to 'present'.
|
Either 'present' or 'absent', defaults to 'present'.
|
||||||
|
|
||||||
owner
|
owner
|
||||||
the role owning this database
|
Specifies the database user who will own the new database.
|
||||||
|
|
||||||
|
encoding
|
||||||
|
Specifies the character encoding scheme to be used in this database.
|
||||||
|
|
||||||
|
lc-collate
|
||||||
|
Specifies the LC_COLLATE setting to be used in this database.
|
||||||
|
|
||||||
|
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
|
EXAMPLES
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
state
|
state
|
||||||
owner
|
owner
|
||||||
|
encoding
|
||||||
|
lc-collate
|
||||||
|
lc-ctype
|
||||||
|
template
|
||||||
|
|
Loading…
Reference in a new issue