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-25 18:17:11 -0700
commitdb669a6911c55d9a5675fb4b42f4de5728f34c76 (patch)
tree9a35b56f81fe845368528795b8c66a38d8bf5c0b /provider_base/services/couchdb.rb
parentedf1306a418203df297d034544d51f5cdcd053c7 (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
+