Tim Starling has submitted this change and it was merged.
Change subject: Migrate scap-1, scap-2, & sync-common from
wikimedia-task-appserver
......................................................................
Migrate scap-1, scap-2, & sync-common from wikimedia-task-appserver
This change migrates three scripts from wikimedia-task-appserver:
- scap-1 (at ff2d5a7fe3 / Gerrit change Iae053bd09)
- scap-2 (at ea5a1a889a / Gerrit change I64d6246ed)
- sync-common (at 66fc5c65cc /
<http://www.mediawiki.org/wiki/Special:Code/MediaWiki/91703>)
Managing these scripts in a single repository will make it easier to update
their content and keep them in sync.
Somewhat awkwardly, the resources representing these scripts must be declared
in class mediawiki::sync, rather than misc::deployment::scap_scripts. This is
because the scripts must be present on both the scap source server and all scap
targets.
Because scap already depends on sync-common, the cross-module dependency is
already in place: misc::deployment::scap_scripts requires
misc::deployment::common_scripts, which in turn requires mediawiki.
The corresponding change to wikimedia-task-appserver to remove these scripts is
I047f37b0a.
I am unfortunately not able to test this thoroughly.
RT: 3276
Bug: 40025
Change-Id: I33d93347f811906f37d503039af7035d122938b9
---
A files/scap/scap-1
A files/scap/scap-2
A files/scap/sync-common
M modules/mediawiki/manifests/sync.pp
4 files changed, 86 insertions(+), 9 deletions(-)
Approvals:
Tim Starling: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/files/scap/scap-1 b/files/scap/scap-1
new file mode 100755
index 0000000..0e6cdc7
--- /dev/null
+++ b/files/scap/scap-1
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+if [ ! -d /usr/local/apache/common-local ];then
+ if ! install -d -o mwdeploy -g mwdeploy /usr/local/apache/common-local;
then
+ echo "Unable to create common-local, please re-run this script
as root."
+ exit 1
+ fi
+fi
+
+if [ ! -d /usr/local/apache/uncommon ];then
+ if ! install -d -o mwdeploy -g mwdeploy /usr/local/apache/uncommon; then
+ echo "Unable to create /usr/local/apache/uncommon, please
re-run this script as root."
+ exit 1
+ fi
+fi
+
+RSYNC_SERVERS="$1"
+SERVER=
+if [ -n "$RSYNC_SERVERS" ]; then
+ SERVER=$(sudo /usr/bin/find-nearest-rsync $RSYNC_SERVERS)
+fi
+if [ -z "$SERVER" ]; then
+ SERVER=10.0.5.8
+fi
+
+sudo -u mwdeploy /usr/bin/scap-2 "$SERVER"
+
+echo Done
+
diff --git a/files/scap/scap-2 b/files/scap/scap-2
new file mode 100755
index 0000000..813b3d7
--- /dev/null
+++ b/files/scap/scap-2
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin:
+TERM=dumb
+
+SERVER="$1"
+if [ -z "$SERVER" ]; then
+ SERVER=10.0.5.8
+fi
+
+echo -n Copying to `hostname -s` from "$SERVER"...
+if rsync -a --delete \
+ --exclude=**/.svn/lock \
+ --exclude=**/.git/objects \
+ --exclude=**/.git/**/objects \
+ --no-perms \
+ "$SERVER"::common/ /usr/local/apache/common-local
+then
+ echo "ok"
+else
+ echo "failed"
+ exit 1
+fi
+
diff --git a/files/scap/sync-common b/files/scap/sync-common
new file mode 100755
index 0000000..17e733c
--- /dev/null
+++ b/files/scap/sync-common
@@ -0,0 +1,3 @@
+#!/bin/sh
+/usr/bin/scap-1
+
diff --git a/modules/mediawiki/manifests/sync.pp
b/modules/mediawiki/manifests/sync.pp
index 7c4eb9d..4745ac8 100644
--- a/modules/mediawiki/manifests/sync.pp
+++ b/modules/mediawiki/manifests/sync.pp
@@ -1,18 +1,39 @@
# mediawiki syncing class
class mediawiki::sync {
- require mediawiki::packages
- require mediawiki::users::l10nupdate
+ require mediawiki::packages
+ require mediawiki::users::l10nupdate
+
+ $scriptpath = $misc::deployment::scap_scripts::scriptpath
+
+ file {
+ "${scriptpath}/scap-1":
+ owner => root,
+ group => root,
+ mode => '0555',
+ source => 'puppet:///files/scap/scap-1';
+ "${scriptpath}/scap-2":
+ owner => root,
+ group => root,
+ mode => '0555',
+ source => 'puppet:///files/scap/scap-2';
+ "${scriptpath}/sync-common":
+ owner => root,
+ group => root,
+ mode => '0555',
+ source => 'puppet:///files/scap/sync-common';
+ }
exec { 'mw-sync':
- command => '/usr/bin/sync-common',
- cwd => '/tmp',
- user => root,
- group => root,
- path => '/usr/bin:/usr/sbin',
+ command => "${scriptpath}/sync-common",
+ require => File["${scriptpath}/sync-common"],
+ cwd => '/tmp',
+ user => root,
+ group => root,
+ path => "${scriptpath}:/usr/bin:/usr/sbin",
refreshonly => true,
- timeout => 600,
- logoutput => on_failure;
+ timeout => 600,
+ logoutput => on_failure;
}
}
--
To view, visit https://gerrit.wikimedia.org/r/57854
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I33d93347f811906f37d503039af7035d122938b9
Gerrit-PatchSet: 8
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits