From 1b5f0892bbcb07fa075bfe8c7b083521b38cb73c Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 19 Jun 2014 00:02:54 -0700 Subject: couchdb: generate hiera files suitable for plain couchdb + read-only mirrors --- provider_base/services/couchdb.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 provider_base/services/couchdb.rb (limited to 'provider_base/services/couchdb.rb') 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 + -- cgit v1.2.3