blob: afab7b50537608c1cd1257342f358bdf0a23ae00 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
define couchdb::create_db (
$host='127.0.0.1:5984',
$admins="{\"names\": [], \"roles\": [] }",
$readers="{\"names\": [], \"roles\": [] }" )
{
Couchdb::Query["create_db_${name}"] -> Couchdb::Document["${name}_security"]
couchdb::query { "create_db_${name}":
cmd => 'PUT',
host => $host,
url => $name,
unless => "/usr/bin/curl -s --netrc-file /etc/couchdb/couchdb.netrc ${host}/${name} | grep -q -v '{\"error\":\"not_found\"'"
}
couchdb::document { "${name}_security":
db => $name,
id => '_security',
host => $host,
data => "{ \"admins\": ${admins}, \"readers\": ${readers} }"
}
}
|