diff options
author | Joseph (Jy) Yaworski <jyaworski@carotid.us> | 2016-09-12 09:09:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-12 09:09:05 -0400 |
commit | f02afe282e5ec3612a666d21911368b3edd7dad1 (patch) | |
tree | 2b0d1e4bc60e81075cc939688be4d13f3ba6a8ae | |
parent | d256c8027c2d34fc8c5c6e0c64be5ff3b5aac8c5 (diff) | |
parent | 33fabe02547a8c4b15278fe8636d83fe1354f4ae (diff) |
Merge pull request #62 from raoulbhatia/ubuntu
[WIP] Ubuntu updates
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | manifests/params.pp | 18 | ||||
-rw-r--r-- | spec/classes/unattended_upgrades_spec.rb | 53 |
3 files changed, 63 insertions, 10 deletions
@@ -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..4451bf1 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -21,6 +21,7 @@ class unattended_upgrades::params { 'lsbdistid' => $::lsbdistid, 'lsbdistcodename' => $::lsbdistcodename, 'lsbmajdistrelease' => $::lsbmajdistrelease, + 'lsbdistrelease' => $::lsbdistrelease, } } else { # Strict variables facts lookup compatibility @@ -37,6 +38,10 @@ class unattended_upgrades::params { true => $::lsbmajdistrelease, default => undef, }, + 'lsbdistrelease' => defined('$lsbdistrelease') ? { + true => $::lsbdistrelease, + default => undef, + }, } } @@ -63,28 +68,31 @@ 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 ] } - 'trusty', 'utopic', 'vivid', 'wily': { + 'trusty', 'wily': { + $legacy_origin = true + $origins = [ + '${distro_id}:${distro_codename}-security', #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 - #'${distro_id}:${distro_codename}-updates', #lint:ignore:single_quote_string_with_variables ] } default: { + warning("Ubuntu ${xfacts['lsbdistrelease']} \"${xfacts['lsbdistcodename']}\" has reached End of Life - please upgrade!") $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..d927a55 100644 --- a/spec/classes/unattended_upgrades_spec.rb +++ b/spec/classes/unattended_upgrades_spec.rb @@ -210,7 +210,6 @@ describe 'unattended_upgrades' do osfamily: 'Debian', lsbdistid: 'Ubuntu', lsbdistcodename: 'precise', - lsbrelease: '12.04', lsbdistrelease: '12.04' } end @@ -234,7 +233,6 @@ describe 'unattended_upgrades' do osfamily: 'Debian', lsbdistid: 'Ubuntu', lsbdistcodename: 'trusty', - lsbrelease: '14.04', lsbdistrelease: '14.04' } end @@ -258,7 +256,6 @@ describe 'unattended_upgrades' do osfamily: 'Debian', lsbdistid: 'Ubuntu', lsbdistcodename: 'vivid', - lsbrelease: '15.04', lsbdistrelease: '15.04' } end @@ -274,6 +271,9 @@ describe 'unattended_upgrades' do };/x ) end + # TODO: implement test case for "warning", similar to + # w = 'Ubuntu 15.04 "vivid" has reached End of Life - please upgrade!' + # it_behaves_like 'has_warning', pp, w end context 'with defaults on Ubuntu 15.10 Wily Werewolf' do @@ -282,7 +282,6 @@ describe 'unattended_upgrades' do osfamily: 'Debian', lsbdistid: 'Ubuntu', lsbdistcodename: 'wily', - lsbrelease: '15.10', lsbdistrelease: '15.10' } end @@ -300,6 +299,52 @@ 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', + 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', + 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 { |