summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2012-11-06 10:39:04 +0100
committervarac <varacanero@zeromail.org>2012-11-06 10:39:04 +0100
commitb598e7d2a4be7ee863ae70450a73bfcda381634e (patch)
treefd37a789b59a1201a44d0e454e4d13d964a9a176
parent110fed8abd8c2d7ef4f73bd1a6d0e0f3665190cf (diff)
couchdb::query::setup to use curl netrc-file, default value for
-rw-r--r--manifests/add_user.pp2
-rw-r--r--manifests/create_db.pp2
-rw-r--r--manifests/query.pp4
-rw-r--r--manifests/query/setup.pp8
4 files changed, 12 insertions, 4 deletions
diff --git a/manifests/add_user.pp b/manifests/add_user.pp
index 3656d7f..acadcd0 100644
--- a/manifests/add_user.pp
+++ b/manifests/add_user.pp
@@ -1,4 +1,4 @@
-define couchdb::add_user ($host, $roles, $pw ) {
+define couchdb::add_user ($host='127.0.0.1:5984', $roles, $pw ) {
couchdb::query { "create_user_$name":
cmd => 'PUT',
host => $host,
diff --git a/manifests/create_db.pp b/manifests/create_db.pp
index 0583d72..c7832be 100644
--- a/manifests/create_db.pp
+++ b/manifests/create_db.pp
@@ -1,4 +1,4 @@
-define couchdb::create_db ($host,
+define couchdb::create_db ($host='127.0.0.1:5984',
$admins="{\"names\": [], \"roles\": [] }",
$readers="{\"names\": [], \"roles\": [] }") {
diff --git a/manifests/query.pp b/manifests/query.pp
index 1667e81..b36f290 100644
--- a/manifests/query.pp
+++ b/manifests/query.pp
@@ -1,3 +1,3 @@
-define couchdb::query ($host, $cmd, $url, $data = '') {
- exec { "/usr/bin/curl -X $cmd $host/$url --data \'$data\'": }
+define couchdb::query ($host='127.0.0.1:5984', $cmd, $url, $data = '') {
+ exec { "/usr/bin/curl --netrc-file /etc/couchdb/couchdb.netrc -X $cmd $host/$url --data \'$data\'": }
}
diff --git a/manifests/query/setup.pp b/manifests/query/setup.pp
new file mode 100644
index 0000000..a5d1657
--- /dev/null
+++ b/manifests/query/setup.pp
@@ -0,0 +1,8 @@
+define couchdb::query::setup ($host='127.0.0.1', $user, $pw) {
+ file { '/etc/couchdb/couchdb.netrc':
+ content => "machine $host login $user password $pw",
+ mode => '0600',
+ owner => 'couchdb',
+ group => 'couchdb',
+ }
+}