From 630ae0d3a9e80c189f485b3e79fbbe0aecd21d7c Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 20 Jun 2014 18:08:02 +0200 Subject: allow setting custom netrc in query and document defines We need to perform some actions as the replication user for plain couch. --- manifests/document.pp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'manifests/document.pp') diff --git a/manifests/document.pp b/manifests/document.pp index 1153296..3ecc05d 100644 --- a/manifests/document.pp +++ b/manifests/document.pp @@ -10,6 +10,7 @@ define couchdb::document( $id, $host = '127.0.0.1:5984', $data = '{}', + $netrc = '/etc/couchdb/couchdb.netrc', $ensure = 'content') { $url = "${host}/${db}/${id}" @@ -17,7 +18,7 @@ define couchdb::document( case $ensure { default: { err ( "unknown ensure value '${ensure}'" ) } content: { - exec { "couch-doc-update --host ${host} --db ${db} --id ${id} --data \'${data}\'": + exec { "couch-doc-update --netrc-file ${netrc} --host ${host} --db ${db} --id ${id} --data \'${data}\'": require => Exec['wait_for_couchdb'], unless => "couch-doc-diff $url '$data'" } @@ -28,7 +29,7 @@ define couchdb::document( cmd => 'PUT', host => $host, path => "${db}/${id}", - unless => "/usr/bin/curl -s -f --netrc-file /etc/couchdb/couchdb.netrc ${url}" + unless => "/usr/bin/curl -s -f --netrc-file ${netrc} ${url}" } } @@ -37,7 +38,7 @@ define couchdb::document( cmd => 'DELETE', host => $host, path => "${db}/${id}", - unless => "/usr/bin/curl -s -f --netrc-file /etc/couchdb/couchdb.netrc ${url}" + unless => "/usr/bin/curl -s -f --netrc-file ${netrc} ${url}" } } } -- cgit v1.2.3