Yuvipanda has submitted this change and it was merged.

Change subject: scap: Move scap master code into own class
......................................................................


scap: Move scap master code into own class

- Create a role class for a scap master
- Scap needs dsh from what I understand, so it should be
  in scap::master
- Remove some layers of indirection that seem unnecessary.

Bug: T87221
Change-Id: Ib96af2cb7a7f84c4f023479312555add37d7c22a
---
M manifests/misc/deployment.pp
M manifests/site.pp
M modules/beta/manifests/scap/master.pp
A modules/scap/manifests/master.pp
M modules/scap/manifests/scripts.pp
R modules/scap/templates/mw-deployment-vars.erb
6 files changed, 34 insertions(+), 53 deletions(-)

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



diff --git a/manifests/misc/deployment.pp b/manifests/misc/deployment.pp
index f8aeebe..2c90f77 100644
--- a/manifests/misc/deployment.pp
+++ b/manifests/misc/deployment.pp
@@ -2,18 +2,6 @@
 
 # deployment hosts
 
-class misc::deployment {
-    system::role { 'misc::deployment': description => 'Deployment host' }
-    include misc::deployment::scap_primary
-    include dsh
-}
-
-# Scripts for the old rsync-based deployment system
-class misc::deployment::scap_scripts {
-    include scap::scripts
-    include misc::deployment::vars
-}
-
 class misc::deployment::fatalmonitor {
     file {
         '/usr/local/bin/fatalmonitor':
@@ -86,7 +74,7 @@
 }
 
 class misc::deployment::l10nupdate {
-    require misc::deployment::scap_scripts
+    require scap::master
 
     cron { 'l10nupdate':
         ensure  => present,
@@ -141,38 +129,6 @@
         '/etc/logrotate.d/l10nupdate':
             source => 'puppet:///files/logrotate/l10nupdate',
             mode   => '0444';
-    }
-}
-
-class misc::deployment::vars {
-    $mw_common = '/srv/mediawiki'
-    $mw_common_source = '/srv/mediawiki-staging'
-
-    if $::realm == 'production' {
-        $mw_rsync_host = 'tin.eqiad.wmnet'
-        $mw_statsd_host = 'statsd.eqiad.wmnet'
-    } else {
-        $mw_rsync_host = "deployment-bastion.${::site}.wmflabs"
-        $mw_statsd_host = "deployment-graphite.${::site}.wmflabs"
-    }
-    $mw_statsd_port = 8125
-
-    file { '/usr/local/lib/mw-deployment-vars.sh':
-        owner   => 'root',
-        group   => 'root',
-        mode    => '0444',
-        content => template('misc/mw-deployment-vars.erb');
-    }
-}
-
-class misc::deployment::scap_primary {
-    include rsync::server
-    include network::constants
-
-    rsync::server::module { 'common':
-        path        => '/srv/mediawiki-staging',
-        read_only   => 'yes',
-        hosts_allow => $::network::constants::mw_appserver_networks;
     }
 }
 
diff --git a/manifests/site.pp b/manifests/site.pp
index b691145..e305b36 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -2410,8 +2410,7 @@
     include standard
     include role::deployment::deployment_servers::production
     include mediawiki
-    include misc::deployment
-    include misc::deployment::scap_scripts
+    include role::scap::master
     include misc::deployment::l10nupdate
     include mysql
     include role::labsdb::manager
diff --git a/modules/beta/manifests/scap/master.pp 
b/modules/beta/manifests/scap/master.pp
index 915cbac..0445209 100644
--- a/modules/beta/manifests/scap/master.pp
+++ b/modules/beta/manifests/scap/master.pp
@@ -5,7 +5,7 @@
 class beta::scap::master {
     include ::beta::config
     include ::beta::scap::target
-    include ::misc::deployment::scap_scripts
+    include ::scap::scripts
     include ::rsync::server
 
     # Install ssh private key for mwdeploy user
diff --git a/modules/scap/manifests/master.pp b/modules/scap/manifests/master.pp
new file mode 100644
index 0000000..ed9b129
--- /dev/null
+++ b/modules/scap/manifests/master.pp
@@ -0,0 +1,21 @@
+# = class: scap::master
+#
+# Sets up a scap master (currently tin). 
+class scap::master(
+    $common_path = '/srv/mediawiki',
+    $common_source_path = '/srv/mediawiki-staging',
+    $rsync_host = 'tin.eqiad.wmnet',
+    $statsd_host = 'statsd.eqiad.wmnet',
+    $statsd_port = 8125,
+) {
+    include scap::scripts
+    include rsync::server
+    include network::constants
+    include dsh
+
+    rsync::server::module { 'common':
+        path        => $common_source_path,
+        read_only   => 'yes',
+        hosts_allow => $::network::constants::mw_appserver_networks;
+    }
+}
diff --git a/modules/scap/manifests/scripts.pp 
b/modules/scap/manifests/scripts.pp
index 44bd7f1..1560ed9 100644
--- a/modules/scap/manifests/scripts.pp
+++ b/modules/scap/manifests/scripts.pp
@@ -126,5 +126,10 @@
             group   => 'root',
             mode    => '0555',
             source  => 'puppet:///modules/scap/sudo-withagent';
+        '/usr/local/lib/mw-deployment-vars.sh':
+            owner   => 'root',
+            group   => 'root',
+            mode    => '0444',
+            content => template('scap/mw-deployment-vars.erb');
     }
 }
diff --git a/templates/misc/mw-deployment-vars.erb 
b/modules/scap/templates/mw-deployment-vars.erb
similarity index 71%
rename from templates/misc/mw-deployment-vars.erb
rename to modules/scap/templates/mw-deployment-vars.erb
index 3f3f3ca..b3c43ea 100644
--- a/templates/misc/mw-deployment-vars.erb
+++ b/modules/scap/templates/mw-deployment-vars.erb
@@ -1,16 +1,16 @@
 # This file should be BASH / Python polyglot.
 PATH="$PATH:/srv/deployment/scap/scap/bin"
 
-MEDIAWIKI_DEPLOYMENT_DIR="<%= @mw_common %>"
-MEDIAWIKI_STAGING_DIR="<%= @mw_common_source %>"
+MEDIAWIKI_DEPLOYMENT_DIR="<%= @common_path %>"
+MEDIAWIKI_STAGING_DIR="<%= @common_source_path %>"
 
 # Back-compat aliases
 MW_COMMON="$MEDIAWIKI_DEPLOYMENT_DIR"
 MW_COMMON_SOURCE="$MEDIAWIKI_STAGING_DIR"
 
 MW_CRON_LOGS="/home/wikipedia/logs/norotate"
-MW_RSYNC_HOST="<%= @mw_rsync_host %>"
+MW_RSYNC_HOST="<%= @rsync_host %>"
 MW_DSH_ARGS=('-cM' '-g' 'mediawiki-installation' '-o' '-oSetupTimeout=30' 
'-F30')
 MW_RSYNC_ARGS=('-a' '--delete-delay' '--delay-updates' '--compress' '--delete' 
'--exclude=**/.svn/lock' '--exclude=**/.git/objects' 
'--exclude=**/.git/**/objects' '--exclude=**/cache/l10n/*.cdb' '--no-perms')
-MW_STATSD_HOST="<%= @mw_statsd_host %>"
-MW_STATSD_PORT=<%= @mw_statsd_port %>
+MW_STATSD_HOST="<%= @statsd_host %>"
+MW_STATSD_PORT=<%= @statsd_port %>

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib96af2cb7a7f84c4f023479312555add37d7c22a
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to