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

Include variable 'RandomSleep'. #33

Merged
merged 1 commit into from
Oct 27, 2015
Merged

Conversation

fbarbeira
Copy link
Contributor

When the apt job starts, it will sleep for a random period between 0 and
APT::Periodic::RandomSleep seconds. The default value is "1800" so that
the script will stall for up to 30 minutes (1800 seconds) so that the
mirror servers are not crushed by everyone running their updates all at
the same time. Only set this to 0 if you use a local mirror and don't
mind the load spikes. Note that while the apt job is sleeping it will
cause the execution of the rest of your cron.daily jobs to be delayed.

When the apt job starts, it will sleep for a random period between 0 and
APT::Periodic::RandomSleep seconds. The default value is "1800" so that
the script will stall for up to 30 minutes (1800 seconds) so that the
mirror servers are not crushed by everyone running their updates all at
the same time. Only set this to 0 if you use a local mirror and don't
mind the load spikes. Note that while the apt job is sleeping it will
cause the execution of the rest of your cron.daily jobs to be delayed.
@ffrank
Copy link
Contributor

ffrank commented Oct 26, 2015

This supersedes #32 I gather.

Thanks. Has the APT::Periodic::RandomSleep option been available in all supported versions of Debian? If so, I'm inclined to merge this as is. Nice work!

@@ -46,3 +46,17 @@ APT::Periodic::Verbose "<%= @verbose %>";
# 1: progress report (actually any string)
# 2: + command outputs (remove -qq, remove 2>/dev/null, add -d)
# 3: + trace on
<%- unless @random_sleep.nil? -%>
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, I keep getting confused by this. Is it Puppet 4 safe? What does undef end up being in the Ruby world?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested on a puppet4 & puppetserver environment and it works fine.

In this page says the following: "Puppet’s special undef value is roughly equivalent to nil in Ruby; it represents the absence of a value."

https://docs.puppetlabs.com/puppet/latest/reference/lang_data_undef.html

@fbarbeira
Copy link
Contributor Author

This configuration flag is compatible with debian 6, 7 and 8. Also with ubuntu 10, 12 and 14.

@@ -93,6 +93,7 @@ Using unattended\_upgrades simply consists of including the module and if needed
* `minimal_steps` (`true`): Split the upgrade process into sections to allow shutdown during upgrade.
* `origins`: The repositories from which to automatically upgrade included packages.
* `package_ensure` (`installed`): The ensure state for the 'unattended-upgrades' package.
* `random_sleep` (`300`): Seconds of delay on the cron job execution.
Copy link
Contributor

Choose a reason for hiding this comment

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

I just realized that this is potentially misleading. The randomness can be gleaned from the option name but the description should be phrased better.

Not a blocker; merging now and we'll fix that in post :-)

ffrank added a commit that referenced this pull request Oct 27, 2015
Include variable 'RandomSleep'.
@ffrank ffrank merged commit e56c49d into voxpupuli:master Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants