summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Fisher <alex@linfratech.co.uk>2016-05-29 11:03:09 +0100
committerAlex Fisher <alex@linfratech.co.uk>2016-05-29 11:03:09 +0100
commitb123117dfe0ef9f8225659a24c31d0bb276b2815 (patch)
tree0ceb7a9c4298d45327fb5878e6b580e2a1dc9b56
parente3866999b958c91095c604b2c92f0951e6a03306 (diff)
parentd7ead6c0c95f20fc48446c3cfdb659f555a9987a (diff)
Merge pull request #61 from raoulbhatia/linuxmint
LinuxMint: Add support for Linux Mint
-rw-r--r--README.md2
-rw-r--r--manifests/params.pp36
-rw-r--r--spec/classes/unattended_upgrades_spec.rb66
3 files changed, 103 insertions, 1 deletions
diff --git a/README.md b/README.md
index c81b759..af74c63 100644
--- a/README.md
+++ b/README.md
@@ -119,7 +119,7 @@ Using unattended\_upgrades simply consists of including the module and if needed
## Limitations
-This module should work across all versions of Debian/Ubuntu.
+This module should work across all versions of Debian, Ubuntu, and Linux Mint.
## License
diff --git a/manifests/params.pp b/manifests/params.pp
index 29bc891..046da45 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -20,6 +20,7 @@ class unattended_upgrades::params {
$xfacts = {
'lsbdistid' => $::lsbdistid,
'lsbdistcodename' => $::lsbdistcodename,
+ 'lsbmajdistrelease' => $::lsbmajdistrelease,
}
} else {
# Strict variables facts lookup compatibility
@@ -32,6 +33,10 @@ class unattended_upgrades::params {
true => $::lsbdistcodename,
default => undef,
},
+ 'lsbmajdistrelease' => defined('$lsbmajdistrelease') ? {
+ true => $::lsbmajdistrelease,
+ default => undef,
+ },
}
}
@@ -84,6 +89,37 @@ class unattended_upgrades::params {
}
}
}
+ 'LinuxMint': {
+ case $xfacts['lsbmajdistrelease'] {
+ # Linux Mint 13 is based on Ubuntu 12.04
+ '13': {
+ $legacy_origin = true
+ $origins = [
+ 'Ubuntu:precise-security',
+ ]
+ }
+ # Linux Mint 17* is based on Ubuntu 14.04.
+ '17': {
+ $legacy_origin = true
+ $origins = [
+ 'Ubuntu:trusty-security',
+ ]
+ }
+ # Linux Mint 18* is based on Ubuntu 16.04
+ '18': {
+ $legacy_origin = true
+ $origins = [
+ 'Ubuntu:xenial-security',
+ ]
+ }
+ default: {
+ $legacy_origin = true
+ $origins = [
+ '${distro_id}:${distro_codename}-security', #lint:ignore:single_quote_string_with_variables
+ ]
+ }
+ }
+ }
default: {
$legacy_origin = undef
$origins = undef
diff --git a/spec/classes/unattended_upgrades_spec.rb b/spec/classes/unattended_upgrades_spec.rb
index fea0ec0..f6e74af 100644
--- a/spec/classes/unattended_upgrades_spec.rb
+++ b/spec/classes/unattended_upgrades_spec.rb
@@ -293,6 +293,72 @@ describe 'unattended_upgrades' do
}
end
+ context 'with defaults on Linux Mint 13 Maya' do
+ let(:facts) { {
+ osfamily: 'Debian',
+ lsbdistid: 'LinuxMint',
+ lsbdistcodename: 'maya',
+ lsbdistrelease: '13',
+ lsbmajdistrelease: '13',
+ } }
+ it {
+ 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"Ubuntu\:precise-security";\n
+ };/x
+ )
+ }
+ end
+
+ context 'with defaults on Linux Mint 17.3 Rosa' do
+ let(:facts) { {
+ osfamily: 'Debian',
+ lsbdistid: 'LinuxMint',
+ lsbdistcodename: 'rosa',
+ lsbdistrelease: '17.3',
+ lsbmajdistrelease: '17',
+ } }
+ it {
+ 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"Ubuntu\:trusty-security";\n
+ };/x
+ )
+ }
+ end
+
+ context 'with defaults on Linux Mint 18 Sarah' do
+ let(:facts) { {
+ osfamily: 'Debian',
+ lsbdistid: 'LinuxMint',
+ lsbdistcodename: 'sarah',
+ lsbdistrelease: '18',
+ lsbmajdistrelease: '18',
+ } }
+ it {
+ 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"Ubuntu\:xenial-security";\n
+ };/x
+ )
+ }
+ end
+
context 'set all the things' do
let :params do
{