Add systemd_randomizeddelaysec#585
Conversation
Allow configuration of the RandomizedDelaySec parameter of the systemd timer, which allows randomizing Puppet runs in a way that lets the administrator see exact moment of the next Puppet run. There's no incompatibility between Puppet's internal splay and this, but both probably shouldn't be used together.
|
@jcharaoui this is marked as WIP:. Does that mean it's not ready for review? |
|
The functionality is ready for review. I marked it WIP because I didn't write a test case for it. Should be pretty simple but unfortunately I'm unfamiliar with puppet module tests. |
ekohl
left a comment
There was a problem hiding this comment.
For the test I'd add a with_content line @
manifests/init.pp
Outdated
| 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, |
There was a problem hiding this comment.
Since the default is 0 and the code doesn't handle undef different from an integer I think this is not optional.
manifests/init.pp
Outdated
| # set 'systemd.timer'. | ||
| # | ||
| # $systemd_randomizeddelaysec:: Adds a random delay between 0 and this value | ||
| # (in seconds) to the timer. |
There was a problem hiding this comment.
This could use a note that it's only relevant when runmode is systemd.timer.
Undef isn't handled, and 0 is default anyways
| with_content(/.*OnCalendar\=\*-\*-\* \*\:10,40:00.*/) | ||
|
|
||
| should contain_file('/etc/systemd/system/puppet-run.timer'). | ||
| with_content(/.*RandomizedDelaySec\=0.*/) |
There was a problem hiding this comment.
I think this can even be /^RandomizedDelaySec\=0$/ since it checks lines. Not sure though.
ekohl
left a comment
There was a problem hiding this comment.
Should be good if Travis is happy :)
|
merged, merci @jcharaoui! |
Allow configuration of the RandomizedDelaySec parameter of the systemd
timer, which allows randomizing Puppet runs in a way that lets the
administrator see exact moment of the next Puppet run. There's no
incompatibility between Puppet's internal splay and this, but both
probably shouldn't be used together.
This probably still needs adjustments to existing tests.