Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add systemd_randomizeddelaysec #585

Merged
merged 5 commits into from
Apr 7, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions manifests/agent/service/systemd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
default => $::puppet::systemd_cmd,
}

$randomizeddelaysec = $::puppet::systemd_randomizeddelaysec

file { "/etc/systemd/system/${::puppet::systemd_unit_name}.timer":
content => template('puppet/agent/systemd.puppet-run.timer.erb'),
notify => [
Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@
# $systemd_cmd:: Specify command to launch when runmode is
# set 'systemd.timer'.
#
# $systemd_randomizeddelaysec:: Adds a random delay between 0 and this value
# (in seconds) to the timer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use a note that it's only relevant when runmode is systemd.timer.

#
# $show_diff:: Show and report changed files with diff output
#
# $module_repository:: Use a different puppet module repository
Expand Down Expand Up @@ -581,6 +584,7 @@
Array[Enum['cron', 'service', 'systemd.timer', 'none']] $unavailable_runmodes = $puppet::params::unavailable_runmodes,
Optional[String] $cron_cmd = $puppet::params::cron_cmd,
Optional[String] $systemd_cmd = $puppet::params::systemd_cmd,
Optional[Integer[0]] $systemd_randomizeddelaysec = $puppet::params::systemd_randomizeddelaysec,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the default is 0 and the code doesn't handle undef different from an integer I think this is not optional.

Boolean $agent_noop = $puppet::params::agent_noop,
Boolean $show_diff = $puppet::params::show_diff,
Optional[Stdlib::HTTPUrl] $module_repository = $puppet::params::module_repository,
Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
$aio_package = ($::osfamily == 'Windows' or $::rubysitedir =~ /\/opt\/puppetlabs\/puppet/)
$deb_naio_package = ($::osfamily == 'Debian')

$systemd_randomizeddelaysec = 0

case $::osfamily {
'Windows' : {
# Windows prefixes normal paths with the Data Directory's path and leaves 'puppet' off the end
Expand Down
1 change: 1 addition & 0 deletions templates/agent/systemd.puppet-run.timer.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Description=Systemd Timer for Puppet Agent
[Timer]
OnCalendar=*-*-* <%= Array(@times[0]).join(',') %>:<%= Array(@times[1]).join(',') %>:00
Persistent=true
RandomizedDelaySec=<%= @randomizeddelaysec %>

[Install]
WantedBy=timers.target