From 1b186d4867e5d5c7552fff11dc93752767f16310 Mon Sep 17 00:00:00 2001 From: Mathieu Sauve-Frankel Date: Mon, 18 Aug 2014 15:33:22 -0700 Subject: [PATCH 1/3] make node.apt.unnattended_upgrades.allowed_origins a little more friendly and supply a sensible default --- attributes/default.rb | 4 +++- templates/default/50unattended-upgrades.erb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index ea8e6944..b5710382 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -30,7 +30,9 @@ default['apt']['unattended_upgrades']['enable'] = false default['apt']['unattended_upgrades']['update_package_lists'] = true # this needs a good default -default['apt']['unattended_upgrades']['allowed_origins'] = [] +default['apt']['unattended_upgrades']['allowed_origins'] = [ + "#{node['platform'].capitalize} #{node['lsb']['codename']}-security" +] default['apt']['unattended_upgrades']['package_blacklist'] = [] default['apt']['unattended_upgrades']['auto_fix_interrupted_dpkg'] = false default['apt']['unattended_upgrades']['minimal_steps'] = false diff --git a/templates/default/50unattended-upgrades.erb b/templates/default/50unattended-upgrades.erb index eaa3fe33..b8cdb45e 100644 --- a/templates/default/50unattended-upgrades.erb +++ b/templates/default/50unattended-upgrades.erb @@ -2,7 +2,7 @@ Unattended-Upgrade::Allowed-Origins { <% unless node['apt']['unattended_upgrades']['allowed_origins'].empty? -%> <% node['apt']['unattended_upgrades']['allowed_origins'].each do |origin| -%> - <%= origin %> + "<%= origin %>"; <% end -%> <% end -%> }; From 1412bef2409482d67e9d1c74c673b670c0127ee7 Mon Sep 17 00:00:00 2001 From: Mathieu Sauve-Frankel Date: Mon, 18 Aug 2014 15:35:49 -0700 Subject: [PATCH 2/3] make node.apt.unattended_upgrades.package_blacklist a little more friendly --- templates/default/50unattended-upgrades.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/default/50unattended-upgrades.erb b/templates/default/50unattended-upgrades.erb index b8cdb45e..d8688b81 100644 --- a/templates/default/50unattended-upgrades.erb +++ b/templates/default/50unattended-upgrades.erb @@ -12,7 +12,7 @@ Unattended-Upgrade::Allowed-Origins { Unattended-Upgrade::Package-Blacklist { <% unless node['apt']['unattended_upgrades']['package_blacklist'].empty? -%> <% node['apt']['unattended_upgrades']['package_blacklist'].each do |package| -%> - <%= package %> + "<%= package %>"; <% end -%> <% end -%> }; From 2124815b86136895dce103c9cad6a3e6aff6528c Mon Sep 17 00:00:00 2001 From: Mathieu Sauve-Frankel Date: Mon, 18 Aug 2014 17:35:38 -0700 Subject: [PATCH 3/3] add workaround for node.lsb on non-linux platforms --- attributes/default.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index b5710382..aa6fbbe9 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -30,8 +30,9 @@ default['apt']['unattended_upgrades']['enable'] = false default['apt']['unattended_upgrades']['update_package_lists'] = true # this needs a good default +codename = node.attribute?('lsb') ? node['lsb']['codename'] : 'notlinux' default['apt']['unattended_upgrades']['allowed_origins'] = [ - "#{node['platform'].capitalize} #{node['lsb']['codename']}-security" + "#{node['platform'].capitalize} #{codename}" ] default['apt']['unattended_upgrades']['package_blacklist'] = [] default['apt']['unattended_upgrades']['auto_fix_interrupted_dpkg'] = false