ArielGlenn has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/393546 )
Change subject: move one more setting out of snapshot hiera and into profiles ...................................................................... move one more setting out of snapshot hiera and into profiles Change-Id: I73b58ffbd149864b38d3550bb6fddbd0f7b8a679 --- M hieradata/hosts/snapshot1001.yaml M hieradata/hosts/snapshot1005.yaml M hieradata/hosts/snapshot1006.yaml M hieradata/hosts/snapshot1007.yaml M modules/profile/manifests/dumps/generation/worker/dumper.pp A modules/profile/manifests/dumps/generation/worker/dumper_shared.pp M modules/role/manifests/dumps/generation/worker/dumper_misc.pp R modules/snapshot/files/dumps/fulldumps.sh M modules/snapshot/manifests/dumps/cron.pp 9 files changed, 29 insertions(+), 21 deletions(-) Approvals: ArielGlenn: Looks good to me, approved jenkins-bot: Verified diff --git a/hieradata/hosts/snapshot1001.yaml b/hieradata/hosts/snapshot1001.yaml index 6e2a15c..d27cca6 100644 --- a/hieradata/hosts/snapshot1001.yaml +++ b/hieradata/hosts/snapshot1001.yaml @@ -1,2 +1 @@ snapshot::dumps::runtype: regular -snapshot::dumps::maxjobs: 6 diff --git a/hieradata/hosts/snapshot1005.yaml b/hieradata/hosts/snapshot1005.yaml index 01f5dc3..c34955f 100644 --- a/hieradata/hosts/snapshot1005.yaml +++ b/hieradata/hosts/snapshot1005.yaml @@ -1,2 +1 @@ snapshot::dumps::runtype: enwiki -snapshot::dumps::maxjobs: 28 diff --git a/hieradata/hosts/snapshot1006.yaml b/hieradata/hosts/snapshot1006.yaml index a0fdda5..ea234d3 100644 --- a/hieradata/hosts/snapshot1006.yaml +++ b/hieradata/hosts/snapshot1006.yaml @@ -1,2 +1 @@ snapshot::dumps::runtype: wikidatawiki -snapshot::dumps::maxjobs: 28 diff --git a/hieradata/hosts/snapshot1007.yaml b/hieradata/hosts/snapshot1007.yaml index 947f240..d27cca6 100644 --- a/hieradata/hosts/snapshot1007.yaml +++ b/hieradata/hosts/snapshot1007.yaml @@ -1,2 +1 @@ snapshot::dumps::runtype: regular -snapshot::dumps::maxjobs: 20 diff --git a/modules/profile/manifests/dumps/generation/worker/dumper.pp b/modules/profile/manifests/dumps/generation/worker/dumper.pp index a7f12db..f06a75d 100644 --- a/modules/profile/manifests/dumps/generation/worker/dumper.pp +++ b/modules/profile/manifests/dumps/generation/worker/dumper.pp @@ -1,5 +1,9 @@ # this class is for snapshot hosts that run regular dumps # meaning sql/xml dumps every couple of weeks or so +# and no other tasks class profile::dumps::generation::worker::dumper { - class { 'snapshot::dumps::cron': user => 'dumpsgen' } + class { 'snapshot::dumps::cron': + user => 'dumpsgen', + maxjobs => '28', + } } diff --git a/modules/profile/manifests/dumps/generation/worker/dumper_shared.pp b/modules/profile/manifests/dumps/generation/worker/dumper_shared.pp new file mode 100644 index 0000000..039bf80 --- /dev/null +++ b/modules/profile/manifests/dumps/generation/worker/dumper_shared.pp @@ -0,0 +1,9 @@ +# this class is for snapshot hosts that run regular dumps +# meaning sql/xml dumps every couple of weeks or so +# and also other jobs +class profile::dumps::generation::worker::dumper_shared { + class { 'snapshot::dumps::cron': + user => 'dumpsgen', + maxjobs => '20', + } +} diff --git a/modules/role/manifests/dumps/generation/worker/dumper_misc.pp b/modules/role/manifests/dumps/generation/worker/dumper_misc.pp index 01c9667..506bf98 100644 --- a/modules/role/manifests/dumps/generation/worker/dumper_misc.pp +++ b/modules/role/manifests/dumps/generation/worker/dumper_misc.pp @@ -3,7 +3,7 @@ include ::profile::base::firewall include profile::dumps::generation::worker::common - include profile::dumps::generation::worker::dumper + include profile::dumps::generation::worker::dumper_shared include profile::dumps::generation::worker::cronrunner include profile::dumps::generation::worker::monitor diff --git a/modules/snapshot/templates/dumps/fulldumps.sh.erb b/modules/snapshot/files/dumps/fulldumps.sh similarity index 96% rename from modules/snapshot/templates/dumps/fulldumps.sh.erb rename to modules/snapshot/files/dumps/fulldumps.sh index 03bcd5c..05abecd 100644 --- a/modules/snapshot/templates/dumps/fulldumps.sh.erb +++ b/modules/snapshot/files/dumps/fulldumps.sh @@ -1,7 +1,7 @@ #!/bin/bash ############################################################# # This file is maintained by puppet! -# modules/snapshot/templates/dumps/fulldumps.sh.erb +# modules/snapshot/dumps/fulldumps.sh ############################################################# # This script is intended to be run out of cron, set to start @@ -86,7 +86,7 @@ fi } -if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" ]; then +if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" -o -z "$5" ]; then usage exit 1 fi @@ -97,11 +97,13 @@ enddate="$2" wikitype="$3" dumptype="$4" +maxjobs="$5" + if [ "$wikitype" == 'none' ]; then # do nothing exit 0 fi -if [ "$5" == "dryrun" ]; then +if [ "$6" == "dryrun" ]; then dryrun=1 else dryrun=0 @@ -172,9 +174,6 @@ exit 1 ;; esac - -# FIXME lookup of hiera value inside of shell script -maxjobs=<%= scope.lookupvar('snapshot::dumps::cron::maxjobs') %> case $dumptype in 'full') diff --git a/modules/snapshot/manifests/dumps/cron.pp b/modules/snapshot/manifests/dumps/cron.pp index a8a4a0c..ed1fc02 100644 --- a/modules/snapshot/manifests/dumps/cron.pp +++ b/modules/snapshot/manifests/dumps/cron.pp @@ -1,6 +1,7 @@ class snapshot::dumps::cron( $enable = true, $user = undef, + $maxjobs = undef, ) { if ($enable) { $ensure = 'present' @@ -9,14 +10,13 @@ $ensure = 'absent' } - $maxjobs = hiera('snapshot::dumps::maxjobs', 28) file { '/usr/local/bin/fulldumps.sh': - ensure => 'present', - path => '/usr/local/bin/fulldumps.sh', - mode => '0755', - owner => 'root', - group => 'root', - content => template('snapshot/dumps/fulldumps.sh.erb'), + ensure => 'present', + path => '/usr/local/bin/fulldumps.sh', + mode => '0755', + owner => 'root', + group => 'root', + source => 'puppet:///modules/snapshot/dumps/fulldumps.sh', } file { '/var/log/dumps': @@ -34,7 +34,7 @@ ensure => 'present', environment => 'MAILTO=ops-du...@wikimedia.org', user => $user, - command => "/usr/local/bin/fulldumps.sh 01 14 ${runtype} full > /dev/null", + command => "/usr/local/bin/fulldumps.sh 01 14 ${runtype} full ${maxjobs} > /dev/null", minute => '05', hour => [8, 20], monthday => '01-14', @@ -44,7 +44,7 @@ ensure => 'present', environment => 'MAILTO=ops-du...@wikimedia.org', user => $user, - command => "/usr/local/bin/fulldumps.sh 20 25 ${runtype} partial > /dev/null", + command => "/usr/local/bin/fulldumps.sh 20 25 ${runtype} partial ${maxjobs} > /dev/null", minute => '05', hour => [8, 20], monthday => '20-25', -- To view, visit https://gerrit.wikimedia.org/r/393546 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I73b58ffbd149864b38d3550bb6fddbd0f7b8a679 Gerrit-PatchSet: 5 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: ArielGlenn <ar...@wikimedia.org> Gerrit-Reviewer: ArielGlenn <ar...@wikimedia.org> Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits