Yuvipanda has submitted this change and it was merged. Change subject: Tools: Make crontab host configurable ......................................................................
Tools: Make crontab host configurable Bug: T87387 Change-Id: Id2c2afc4d9032f203a13ea832ad26e4aca0dfc39 --- M modules/toollabs/manifests/bastion.pp R modules/toollabs/templates/crontab.erb 2 files changed, 13 insertions(+), 11 deletions(-) Approvals: Yuvipanda: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/toollabs/manifests/bastion.pp b/modules/toollabs/manifests/bastion.pp index c7b2181..785e91d 100644 --- a/modules/toollabs/manifests/bastion.pp +++ b/modules/toollabs/manifests/bastion.pp @@ -10,7 +10,9 @@ # # Sample Usage: # -class toollabs::bastion inherits toollabs { +class toollabs::bastion( + $cron_host = 'tools-submit', +) inherits toollabs { include gridengine::submit_host, gridengine::admin_host, @@ -58,11 +60,11 @@ } file { '/usr/local/bin/xcrontab': - ensure => file, - mode => '0755', - owner => 'root', - group => 'root', - source => 'puppet:///modules/toollabs/crontab', + ensure => file, + mode => '0755', + owner => 'root', + group => 'root', + content => template('toollabs/crontab.erb'), } } diff --git a/modules/toollabs/files/crontab b/modules/toollabs/templates/crontab.erb similarity index 92% rename from modules/toollabs/files/crontab rename to modules/toollabs/templates/crontab.erb index cea3596..3c397dd 100755 --- a/modules/toollabs/files/crontab +++ b/modules/toollabs/templates/crontab.erb @@ -23,7 +23,7 @@ # This goes in /usr/local/bin to override the system crontab (which will # have its permissions restricted). # -# Source: modules/toollabs/files/crontab +# Source: modules/toollabs/templates/crontab.erb # From: toollabs::submit use strict; @@ -32,7 +32,7 @@ use File::Temp qw(tempfile); sub submit(@) { - exec { '/usr/bin/ssh' } 'ssh', 'tools-submit', '/usr/bin/crontab', @_; + exec { '/usr/bin/ssh' } 'ssh', '<%= @cron_host %>', '/usr/bin/crontab', @_; die "$0: unable to execute remote crontab command\n"; } @@ -103,7 +103,7 @@ my $crontab = ''; die "$0: usage error: no arguments permitted after this option\n" unless $#ARGV<0; - if(open OLD, "/usr/bin/ssh tools-submit /usr/bin/crontab$dashu -l 2>/dev/null |") { + if(open OLD, "/usr/bin/ssh <%= @cron_host %> /usr/bin/crontab$dashu -l 2>/dev/null |") { $crontab = ''; while(<OLD>) { $crontab .= $_; @@ -148,7 +148,7 @@ my $crlino = 0; my $modified = 0; -if(open NEW, "| /usr/bin/ssh tools-submit /usr/bin/crontab$dashu -") { +if(open NEW, "| /usr/bin/ssh <%= @cron_host %> /usr/bin/crontab$dashu -") { foreach my $line (@crontab) { if($line =~ m/^([^#][^=\t ]+\s+\S+\s+\S+\s+\S+\s+\S+\s+|\@\S+\s+)([^#\n]*)(#.*)?\n?$/) { $crlino++; @@ -170,7 +170,7 @@ } close NEW; } else { - die "$0: unable to install new crontab on tools-submit\n"; + die "$0: unable to install new crontab on <%= @cron_host %>\n"; } if($modified) { -- To view, visit https://gerrit.wikimedia.org/r/190977 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id2c2afc4d9032f203a13ea832ad26e4aca0dfc39 Gerrit-PatchSet: 3 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Tim Landscheidt <t...@tim-landscheidt.de> Gerrit-Reviewer: Yuvipanda <yuvipa...@gmail.com> Gerrit-Reviewer: coren <mpellet...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits