summaryrefslogtreecommitdiff
path: root/manifests/mirror_db.pp
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2014-06-20 18:08:02 +0200
committerAzul <azul@riseup.net>2014-06-20 18:08:02 +0200
commit630ae0d3a9e80c189f485b3e79fbbe0aecd21d7c (patch)
tree1e4b5bbed1c5c2681fa59a2ce7005699b0dedcff /manifests/mirror_db.pp
parent75e62f1aa97b6702b82d28ddc768a92c0a831b5c (diff)
allow setting custom netrc in query and document defines
We need to perform some actions as the replication user for plain couch.
Diffstat (limited to 'manifests/mirror_db.pp')
-rw-r--r--manifests/mirror_db.pp12
1 files changed, 8 insertions, 4 deletions
diff --git a/manifests/mirror_db.pp b/manifests/mirror_db.pp
index c2e5b21..06007e0 100644
--- a/manifests/mirror_db.pp
+++ b/manifests/mirror_db.pp
@@ -3,14 +3,18 @@ define couchdb::mirror_db (
$from='',
$to='' )
{
- $source = "$from$name"
- $target = "$to$name"
+ $source = "$from/$name"
+ if $to == '' { $target = $name }
+ else { $target = "$to/$name" }
+
+ $replication_user = "replication"
+ $replication_role = "replication"
couchdb::document { "${name}_replication":
- db => "_replicate",
+ db => "_replicator",
id => "${name}_replication",
host => $host,
- data => "{ \"source\": ${source}, \"target\": ${target}, \"continuous\": true }",
+ data => "{ \"source\": \"${source}\", \"target\": \"${target}\", \"continuous\": true, \"user_ctx\": { \"name\": \"${replication_user}\", \"roles\": [\"${replication_role}\"] } }",
require => Couchdb::Query["create_db_${name}"]
}
}