From a6d9c2dea3d67f7368fef373e96bfb0fda612851 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 16 Sep 2013 16:00:40 +0200 Subject: 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. --- manifests/create_db.pp | 13 +++++++------ 1 file 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} }" } } -- cgit v1.2.3