From 2835cfbc652e37f8daccc36282cfbd5f34cad918 Mon Sep 17 00:00:00 2001 From: Raoul Bhatia Date: Sat, 28 May 2016 16:41:01 +0200 Subject: Ubuntu: Add 16.04 Xenial Xerus and 16.10 Yakkety Yak. --- README.md | 2 +- manifests/params.pp | 10 ++++--- spec/classes/unattended_upgrades_spec.rb | 48 ++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index af74c63..4fd3f3e 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ Using unattended\_upgrades simply consists of including the module and if needed * `dl_limit`(`undef`): Use a bandwidth limit for downloading, specified in kb/sec. * `enable` (`1`): Enable the automatic installation of updates. * `install_on_shutdown` (`false`): Install updates on shutdown instead of in the background. -* `legacy_origin` (`true` for Debian (squeeze), Ubuntu (precise, trusty, utopic, vivid, wily and default), `false`for Debian (wheezy and default)): Use the legacy `Unattended-Upgrade::Allowed-Origins` setting or the modern `Unattended-Upgrade::Origins-Pattern`. +* `legacy_origin` (`true` for Debian (squeeze), Ubuntu (precise, trusty, utopic, vivid, wily, xenial, yakkety, and default), `false` for Debian (wheezy and default)): Use the legacy `Unattended-Upgrade::Allowed-Origins` setting or the modern `Unattended-Upgrade::Origins-Pattern`. * `mail`: A hash to configure email behaviour with two possible keys: * `only_on_error` (`true`): Only send mail when something went wrong * `to` (`undef`): Email address to send email too diff --git a/manifests/params.pp b/manifests/params.pp index 046da45..007464c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -63,13 +63,11 @@ class unattended_upgrades::params { } } 'ubuntu': { - # TODO do we really want to pull in ${distro_codename}-updates by default? case $xfacts['lsbdistcodename'] { 'precise': { $legacy_origin = true $origins = [ '${distro_id}:${distro_codename}-security', #lint:ignore:single_quote_string_with_variables - #'${distro_id}:${distro_codename}-updates', #lint:ignore:single_quote_string_with_variables ] } @@ -77,14 +75,18 @@ class unattended_upgrades::params { $legacy_origin = true $origins = [ '${distro_id}:${distro_codename}-security', #lint:ignore:single_quote_string_with_variables - #'${distro_id}:${distro_codename}-updates', #lint:ignore:single_quote_string_with_variables + ] + } + 'xenial', 'yakkety': { + $legacy_origin = true + $origins = [ + '${distro_id}:${distro_codename}-security', #lint:ignore:single_quote_string_with_variables ] } default: { $legacy_origin = true $origins = [ '${distro_id}:${distro_codename}-security', #lint:ignore:single_quote_string_with_variables - #'${distro_id}:${distro_codename}-updates', #lint:ignore:single_quote_string_with_variables ] } } diff --git a/spec/classes/unattended_upgrades_spec.rb b/spec/classes/unattended_upgrades_spec.rb index c3b9673..ecbce37 100644 --- a/spec/classes/unattended_upgrades_spec.rb +++ b/spec/classes/unattended_upgrades_spec.rb @@ -300,6 +300,54 @@ describe 'unattended_upgrades' do end end + context 'with defaults on Ubuntu 16.04 Xenial Xerus' do + let(:facts) do + { + osfamily: 'Debian', + lsbdistid: 'Ubuntu', + lsbdistcodename: 'xenial', + lsbrelease: '16.04', + lsbdistrelease: '16.04' + } + end + it do + should create_file(file_unattended).with( + owner: 'root', + group: 'root', + mode: '0644' + ).with_content( + # This is the only section that's different for Ubuntu compared to Debian + /\Unattended-Upgrade::Allowed-Origins\ {\n + \t"\${distro_id}\:\${distro_codename}-security";\n + };/x + ) + end + end + + context 'with defaults on Ubuntu 16.10 Yakkety Yak' do + let(:facts) do + { + osfamily: 'Debian', + lsbdistid: 'Ubuntu', + lsbdistcodename: 'yakkety', + lsbrelease: '16.10', + lsbdistrelease: '16.10' + } + end + it do + should create_file(file_unattended).with( + owner: 'root', + group: 'root', + mode: '0644' + ).with_content( + # This is the only section that's different for Ubuntu compared to Debian + /\Unattended-Upgrade::Allowed-Origins\ {\n + \t"\${distro_id}\:\${distro_codename}-security";\n + };/x + ) + end + end + context 'with defaults on Raspbian' do let(:facts) do { -- cgit v1.2.3