Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinuxMint: Add support for Linux Mint #61

Merged
merged 1 commit into from
May 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
36 changes: 36 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
$xfacts = {
'lsbdistid' => $::lsbdistid,
'lsbdistcodename' => $::lsbdistcodename,
'lsbmajdistrelease' => $::lsbmajdistrelease,
}
} else {
# Strict variables facts lookup compatibility
Expand All @@ -32,6 +33,10 @@
true => $::lsbdistcodename,
default => undef,
},
'lsbmajdistrelease' => defined('$lsbmajdistrelease') ? {
true => $::lsbmajdistrelease,
default => undef,
},
}
}

Expand Down Expand Up @@ -84,6 +89,37 @@
}
}
}
'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
Expand Down
66 changes: 66 additions & 0 deletions spec/classes/unattended_upgrades_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,72 @@
}
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
{
Expand Down