Dzahn has submitted this change and it was merged.

Change subject: Gerrit: Automate slave mode detection
......................................................................


Gerrit: Automate slave mode detection

Means you only have to adjust one setting to pick the master
rather than adjusting multiple hiera values and accidentally
giving yourself multiple masters.

Change-Id: I20f5c56888d34483b06c09221e2a4923366c0189
---
D hieradata/hosts/cobalt.yaml
D hieradata/hosts/lead.yaml
M hieradata/role/common/gerrit/server.yaml
M modules/gerrit/manifests/init.pp
4 files changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Dzahn: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/hieradata/hosts/cobalt.yaml b/hieradata/hosts/cobalt.yaml
deleted file mode 100644
index 06d151a..0000000
--- a/hieradata/hosts/cobalt.yaml
+++ /dev/null
@@ -1 +0,0 @@
-gerrit::slave: false
diff --git a/hieradata/hosts/lead.yaml b/hieradata/hosts/lead.yaml
deleted file mode 100644
index 06d151a..0000000
--- a/hieradata/hosts/lead.yaml
+++ /dev/null
@@ -1 +0,0 @@
-gerrit::slave: false
diff --git a/hieradata/role/common/gerrit/server.yaml 
b/hieradata/role/common/gerrit/server.yaml
index 1d45c2e..4303f62 100644
--- a/hieradata/role/common/gerrit/server.yaml
+++ b/hieradata/role/common/gerrit/server.yaml
@@ -5,6 +5,7 @@
   debdeploy-gerrit:
     value: standard
 gerrit::host: 'gerrit.wikimedia.org'
+gerrit::master_host: 'cobalt.wikimedia.org'
 # Assume all production nodes are slaves
 gerrit::slave: true
 gerrit::jetty::git_dir: '/srv/gerrit/git'
diff --git a/modules/gerrit/manifests/init.pp b/modules/gerrit/manifests/init.pp
index dcfef68..3a638aa 100644
--- a/modules/gerrit/manifests/init.pp
+++ b/modules/gerrit/manifests/init.pp
@@ -1,11 +1,16 @@
 # Manifest to setup a Gerrit instance
 
-class gerrit($host = undef, $slave = false) {
+class gerrit($host = undef, $master_host = $::fqdn) {
 
     if $host == undef {
         fail('$gerrit::host must be set!')
     }
 
+    $slave = $master_host ? {
+        $::fqdn => false,
+        default => true
+    }
+
     class { 'gerrit::jetty':
         slave => $slave,
     }

-- 
To view, visit https://gerrit.wikimedia.org/r/316015
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I20f5c56888d34483b06c09221e2a4923366c0189
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Dzahn <dz...@wikimedia.org>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to