Skip to content

Add systemd_randomizeddelaysec#585

Merged
mmoll merged 5 commits intotheforeman:masterfrom
jcharaoui:systemd_randomizeddelaysec
Apr 7, 2018
Merged

Add systemd_randomizeddelaysec#585
mmoll merged 5 commits intotheforeman:masterfrom
jcharaoui:systemd_randomizeddelaysec

Conversation

@jcharaoui
Copy link
Copy Markdown
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
Copy Markdown
Member

ekohl commented Mar 12, 2018

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

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

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
Copy Markdown
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.

# set 'systemd.timer'.
#
# $systemd_randomizeddelaysec:: Adds a random delay between 0 and this value
# (in seconds) to the timer.
Copy link
Copy Markdown
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.

with_content(/.*OnCalendar\=\*-\*-\* \*\:10,40:00.*/)

should contain_file('/etc/systemd/system/puppet-run.timer').
with_content(/.*RandomizedDelaySec\=0.*/)
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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