From 35b903c241bc1a41b5d7678c7deef7edcebe9ff4 Mon Sep 17 00:00:00 2001 From: Frank Solli Date: Fri, 6 Jun 2014 11:49:43 +0200 Subject: [PATCH 1/4] Add support for randomsleep, follow the NONE-pattern seen in other variables --- templates/10periodic.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/10periodic.erb b/templates/10periodic.erb index 5737c9ac29..c84c24d26d 100644 --- a/templates/10periodic.erb +++ b/templates/10periodic.erb @@ -10,3 +10,4 @@ APT::Periodic::Download-Upgradeable-Packages-Debdelta "<%= @download_delta %>"; APT::Periodic::Unattended-Upgrade "<%= @upgrade %>"; APT::Periodic::AutocleanInterval "<%= @autoclean %>"; APT::Periodic::Verbose "<%= @verbose %>"; +<% if @randomsleep != "NONE" %>APT::Periodic::RandomSleep "<%= @randomsleep %>";<% end %> From ef50550c4abfed467e4db48d9c4ce8968e65c2aa Mon Sep 17 00:00:00 2001 From: Frank Solli Date: Fri, 6 Jun 2014 11:50:04 +0200 Subject: [PATCH 2/4] add support for randomsleep, follow the pattern seen elsewhere --- manifests/unattended_upgrades.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index c57a9ee7f5..edf57b8a7a 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -27,6 +27,7 @@ $mail_only_on_error = false, $remove_unused = true, $auto_reboot = false, + $randomsleep = "NONE", $dl_limit = "NONE", $enable = "1", $backup_interval = "0", From ccb2413ecdc832598033ea5d1251a83ac2b87878 Mon Sep 17 00:00:00 2001 From: Frank Solli Date: Fri, 6 Jun 2014 11:53:24 +0200 Subject: [PATCH 3/4] add RandomSleep test --- spec/classes/unattended_upgrades_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/classes/unattended_upgrades_spec.rb b/spec/classes/unattended_upgrades_spec.rb index a2fb48b126..396bc8bc66 100644 --- a/spec/classes/unattended_upgrades_spec.rb +++ b/spec/classes/unattended_upgrades_spec.rb @@ -267,6 +267,13 @@ it { should contain_file(file_periodic).with_content(/^APT::Periodic::MinAge "1";$/) } end + describe "with randomsleep => 1800" do + let :params do + { :min_age => "1800" } + end + it { should contain_file(file_periodic).with_content(/^APT::Periodic::RandomSleep "1800";$/) } + end + describe "with max_size => 1" do let :params do { :max_size => "1" } From 5bc7dd011f1e1570cea6220ec87681fae89c816c Mon Sep 17 00:00:00 2001 From: Frank Solli Date: Fri, 6 Jun 2014 12:02:50 +0200 Subject: [PATCH 4/4] Fix name for param --- spec/classes/unattended_upgrades_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/unattended_upgrades_spec.rb b/spec/classes/unattended_upgrades_spec.rb index 396bc8bc66..4587cfc20c 100644 --- a/spec/classes/unattended_upgrades_spec.rb +++ b/spec/classes/unattended_upgrades_spec.rb @@ -269,7 +269,7 @@ describe "with randomsleep => 1800" do let :params do - { :min_age => "1800" } + { :randomsleep => "1800" } end it { should contain_file(file_periodic).with_content(/^APT::Periodic::RandomSleep "1800";$/) } end