summaryrefslogtreecommitdiff
path: root/manifests/create_db.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/create_db.pp')
-rw-r--r--manifests/create_db.pp13
1 files changed, 7 insertions, 6 deletions
diff --git a/manifests/create_db.pp b/manifests/create_db.pp
index 32bc974..690892c 100644
--- a/manifests/create_db.pp
+++ b/manifests/create_db.pp
@@ -4,6 +4,8 @@ define couchdb::create_db (
$readers="{\"names\": [], \"roles\": [] }" )
{
+ Couchdb::Query["create_db_${name}"] -> Couchdb::Document["${name}_security"]
+
couchdb::query { "create_db_${name}":
cmd => 'PUT',
host => $host,
@@ -11,11 +13,10 @@ define couchdb::create_db (
unless => "/usr/bin/curl -s --netrc-file /etc/couchdb/couchdb.netrc ${host}/${name} | grep -q -v '{\"error\":\"not_found\"'"
}
- couchdb::query { "${name}_security":
- cmd => 'PUT',
- host => $host,
- path => "${name}/_security",
- data => "{ \"admins\": ${admins}, \"readers\": ${readers} }",
- require => Couchdb::Query["create_db_${name}"]
+ couchdb::document { "${name}_security":
+ db => $name,
+ id => '_security',
+ host => $host,
+ data => "{ \"admins\": ${admins}, \"readers\": ${readers} }"
}
}