-
Notifications
You must be signed in to change notification settings - Fork 229
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
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the test I'd add a with_content
line @
with_content(/.*OnCalendar\=\*-\*-\* \*\:10,40:00.*/) |
manifests/init.pp
Outdated
@@ -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, |
There was a problem hiding this comment.
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.
manifests/init.pp
Outdated
@@ -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. |
There was a problem hiding this comment.
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
.
Undef isn't handled, and 0 is default anyways
@@ -68,6 +68,9 @@ | |||
should contain_file('/etc/systemd/system/puppet-run.timer'). | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can even be /^RandomizedDelaySec\=0$/
since it checks lines. Not sure though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.