From 3799e3a23c7d4e74c99aa4ec7e42de0b486ffe67 Mon Sep 17 00:00:00 2001 From: Mikko Pesari Date: Wed, 18 Feb 2015 18:09:53 +0200 Subject: [PATCH 1/2] unattended_upgrades: Allow changing legacy_origin This enables using Origins-Pattern in Ubuntu. --- README.md | 13 +++++++------ manifests/unattended_upgrades.pp | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b325ba9..0bf17c4 100644 --- a/README.md +++ b/README.md @@ -74,12 +74,13 @@ class { 'apt': ``` class { 'apt::unattended_upgrades': - origins => $::apt::params::origins, - blacklist => [], - update => '1', - download => '1', - upgrade => '1', - autoclean => '7', + legacy_origin => $::apt::params::legacy_origin, + origins => $::apt::params::origins, + blacklist => [], + update => '1', + download => '1', + upgrade => '1', + autoclean => '7', } ``` diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index b835b9a..028ffc6 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -14,6 +14,7 @@ # file and in /etc/cron.daily/apt # class apt::unattended_upgrades ( + $legacy_origin = $::apt::params::legacy_origin, $origins = $::apt::params::origins, $blacklist = [], $update = '1', @@ -40,6 +41,7 @@ class apt::unattended_upgrades ( ) inherits ::apt::params { validate_bool( + $legacy_origin, $auto_fix, $minimal_steps, $install_on_shutdown, From 81bb96c898657f7d6045ddeb4b3701ab94cffa4d Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Fri, 13 Mar 2015 14:56:53 -0700 Subject: [PATCH 2/2] Update docs and test for $legacy_origin --- README.md | 1 + spec/classes/unattended_upgrades_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bf17c4..501adc6 100644 --- a/README.md +++ b/README.md @@ -278,6 +278,7 @@ apt::sources: ####apt::unattended_upgrades +* `legacy_origin`: If set to true, use the old `Unattended-Upgrade::Allowed-Origins` variable. If false, use `Unattended-Upgrade::Origins-Pattern`. OS-dependent defaults are defined in `apt::params`. * `origins`: The repositories from which to automatically upgrade included packages. * `blacklist`: A list of packages to **not** automatically upgrade. * `update`: How often, in days, to run `apt-get update`. diff --git a/spec/classes/unattended_upgrades_spec.rb b/spec/classes/unattended_upgrades_spec.rb index 3742bf1..0a02755 100644 --- a/spec/classes/unattended_upgrades_spec.rb +++ b/spec/classes/unattended_upgrades_spec.rb @@ -155,6 +155,7 @@ describe 'apt::unattended_upgrades', :type => :class do let :params do { + 'legacy_origin' => true, 'enable' => '0', 'backup_interval' => '3', 'backup_level' => '1', @@ -181,7 +182,7 @@ describe 'apt::unattended_upgrades', :type => :class do } end - it { is_expected.to contain_file("/etc/apt/apt.conf.d/50unattended-upgrades").with_content %r{Unattended-Upgrade::Origins-Pattern \{\n\t"bananas";\n\};} } + it { is_expected.to contain_file("/etc/apt/apt.conf.d/50unattended-upgrades").with_content %r{Unattended-Upgrade::Allowed-Origins \{\n\t"bananas";\n\};} } it { is_expected.to contain_file("/etc/apt/apt.conf.d/50unattended-upgrades").with_content %r{Unattended-Upgrade::Package-Blacklist \{\n\t"foo";\n\t"bar";\n\};} } it { is_expected.to contain_file("/etc/apt/apt.conf.d/50unattended-upgrades").with_content %r{Unattended-Upgrade::AutoFixInterruptedDpkg "false";}} it { is_expected.to contain_file("/etc/apt/apt.conf.d/50unattended-upgrades").with_content %r{Unattended-Upgrade::MinimalSteps "true";}}