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

Conversation

jcharaoui
Copy link
Contributor

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.

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.
@ekohl
Copy link
Member

ekohl commented Mar 12, 2018

@jcharaoui this is marked as WIP:. Does that mean it's not ready for review?

@jcharaoui
Copy link
Contributor Author

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.

Copy link
Member

@ekohl ekohl left a 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.*/)

@@ -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.

@@ -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.

@@ -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.*/)
Copy link
Member

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.

Copy link
Member

@ekohl ekohl left a 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 :)

@mmoll mmoll merged commit 98aa874 into theforeman:master Apr 7, 2018
@mmoll
Copy link
Contributor

mmoll commented Apr 7, 2018

merged, merci @jcharaoui!

@jcharaoui jcharaoui deleted the systemd_randomizeddelaysec branch April 9, 2018 01:30
@ekohl ekohl changed the title WIP: Add systemd_randomizeddelaysec Add systemd_randomizeddelaysec May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants