Thcipriani has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/198173

Change subject: Allow override of sync_common config
......................................................................

Allow override of sync_common config

Add an optional override of scap.cfg via hiera.

Needed to automate the setup of appservers in the staging environment
in labs.

Bug: T91548
Change-Id: Ia76802ecaee64bee8066ce33724e3c1c6992051e
---
M modules/mediawiki/manifests/scap.pp
1 file changed, 19 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/73/198173/1

diff --git a/modules/mediawiki/manifests/scap.pp 
b/modules/mediawiki/manifests/scap.pp
index 05fa63f..b1c9c0a 100644
--- a/modules/mediawiki/manifests/scap.pp
+++ b/modules/mediawiki/manifests/scap.pp
@@ -5,13 +5,20 @@
 # scap is installed, that the shell environment is configured for
 # MediaWiki, and that the MediaWiki deployment directory exists and
 # contains a copy of MediaWiki.
+
+# === Parameters:
+# [*defines*]
+#   Optional. Add override parameters for scap's config.
 #
-class mediawiki::scap {
+class mediawiki::scap(
+    $defines = undef,
+) {
     include ::mediawiki::users
 
     $mediawiki_deployment_dir = '/srv/mediawiki'
     $mediawiki_staging_dir    = '/srv/mediawiki-staging'
     $scap_bin_dir             = '/srv/deployment/scap/scap/bin'
+    $scap_cmd                 = "${scap_bin_dir}/sync-common"
     $mediawiki_web_user       = $::mediawiki::users::web
 
     # 'scap' is the command-line tool we use to push MediaWiki changes
@@ -48,8 +55,18 @@
     # If this is a new install, populate /srv/mediawiki by retrieving
     # the current MediaWiki deployment tree from the deployment server.
 
+    # override scap config file with hiera variables in labs, e.g.:
+    # mediawiki::scap::defines: master_rsync:staging-tin.eqiad.wmflabs
+    if $defines {
+        $scap_defines = join(concat([], $defines), ' --define ')
+
+        $sync_common = "${scap_cmd} --define ${scap_defines}"
+    } else {
+        $sync_common = $scap_cmd
+    }
+
     exec { 'fetch_mediawiki':
-        command => "${scap_bin_dir}/sync-common",
+        command => $sync_common,
         creates => "${mediawiki_deployment_dir}/docroot",
         require => [ File[$mediawiki_deployment_dir], Package['scap'] ],
         timeout => 30 * 60,  # 30 minutes

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia76802ecaee64bee8066ce33724e3c1c6992051e
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Thcipriani <tcipri...@wikimedia.org>

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

Reply via email to