diff options
author | Azul <azul@riseup.net> | 2013-09-16 16:00:40 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2013-09-19 10:32:43 +0200 |
commit | a6d9c2dea3d67f7368fef373e96bfb0fda612851 (patch) | |
tree | 20fa7a8fc9c44cb5c6d480fb7a4d9569dc218feb | |
parent | 54f3815e85a37958b6d49e99e5b8d7f04ed3c5b8 (diff) |
Revert "don't use couchdb::document for creating _security, cause this special doc doesn't have an _id (#3706)"
This reverts commit dacaeb4d98be9468336923f5501822d389bda768.
couch-doc-update and thus couchdb::document now also work for _security
documents. We simply add the given _id when none is present in the
existing doc. Using the normal saving of CouchRest::Document then works.
-rw-r--r-- | manifests/create_db.pp | 13 |
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} }" } } |