summaryrefslogtreecommitdiff
path: root/provider_base/services/couchdb.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-06-19 00:02:54 -0700
committerelijah <elijah@riseup.net>2014-06-19 00:02:54 -0700
commit1b5f0892bbcb07fa075bfe8c7b083521b38cb73c (patch)
tree9e30266c52b6be3f4c20eb55829493b465829ef7 /provider_base/services/couchdb.rb
parentf991e8a4c877cff1d274fd1cac26488f8c3fda84 (diff)
couchdb: generate hiera files suitable for plain couchdb + read-only mirrors
Diffstat (limited to 'provider_base/services/couchdb.rb')
-rw-r--r--provider_base/services/couchdb.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/provider_base/services/couchdb.rb b/provider_base/services/couchdb.rb
new file mode 100644
index 00000000..c8f5d8a7
--- /dev/null
+++ b/provider_base/services/couchdb.rb
@@ -0,0 +1,18 @@
+#
+# custom logic for couchdb json resolution
+#
+
+unless nodes_like_me['services' => 'couchdb']['couch.master' => true].any?
+ raise 'node `%s`, environment `%s`: there must be at least one node with couch.master set to `true` for this environment.' % [@node.name, @node.environment]
+end
+
+if couch.master
+ if nodes_like_me['services' => 'couchdb']['couch.master' => true].size > 1
+ apply_partial 'services/_couchdb_multimaster.json'
+ else
+ apply_partial 'services/_couchdb_master.json'
+ end
+else
+ apply_partial 'services/_couchdb_mirror.json'
+end
+