summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Pronk <robin.pronk@nedap.com>2017-06-28 10:59:08 +0200
committerVarac <varac@leap.se>2017-10-13 14:57:23 +0200
commite1d242de5e969d7348a5aaf8a1b224593f1bfb58 (patch)
treef824d8cb7fb38006968c852c03366f1729052a62
parent7917df20971ebd11717a85a0f02a963a4d87fd0a (diff)
Update Debian upstream names
* Wheezy is now oldoldstable * jessie oldstable * stretch stable * Add Stretch to supported releases
-rw-r--r--manifests/params.pp10
-rw-r--r--metadata.json4
-rw-r--r--spec/classes/debian_spec.rb150
3 files changed, 160 insertions, 4 deletions
diff --git a/manifests/params.pp b/manifests/params.pp
index dbdb91b..0d205a9 100644
--- a/manifests/params.pp
+++ b/manifests/params.pp
@@ -50,14 +50,18 @@ class unattended_upgrades::params {
case $xfacts['lsbdistcodename'] {
'squeeze': {
$legacy_origin = true
- $origins = ['${distro_id} oldoldstable', #lint:ignore:single_quote_string_with_variables
- '${distro_id} ${distro_codename}-security', #lint:ignore:single_quote_string_with_variables
+ $origins = ['${distro_id} ${distro_codename}-security', #lint:ignore:single_quote_string_with_variables
'${distro_id} ${distro_codename}-lts',] #lint:ignore:single_quote_string_with_variables
}
'wheezy': {
$legacy_origin = false
$origins = [
- 'origin=Debian,archive=stable,label=Debian-Security',
+ 'origin=Debian,archive=oldoldstable,label=Debian-Security',
+ ]
+ }
+ 'jessie': {
+ $legacy_origin = false
+ $origins = [
'origin=Debian,archive=oldstable,label=Debian-Security',
]
}
diff --git a/metadata.json b/metadata.json
index de960ab..66b6789 100644
--- a/metadata.json
+++ b/metadata.json
@@ -12,7 +12,9 @@
"operatingsystem": "Debian",
"operatingsystemrelease": [
"6",
- "7"
+ "7",
+ "8",
+ "9"
]
},
{
diff --git a/spec/classes/debian_spec.rb b/spec/classes/debian_spec.rb
new file mode 100644
index 0000000..bbfd354
--- /dev/null
+++ b/spec/classes/debian_spec.rb
@@ -0,0 +1,150 @@
+require 'spec_helper'
+
+# rubocop:disable Style/RegexpLiteral
+describe 'unattended_upgrades' do
+ let(:file_unattended) { '/etc/apt/apt.conf.d/50unattended-upgrades' }
+ let(:file_periodic) { '/etc/apt/apt.conf.d/10periodic' }
+ let(:file_options) { '/etc/apt/apt.conf.d/10options' }
+
+ let(:pre_condition) do
+ 'include ::apt'
+ end
+
+ shared_examples 'Debian specs' do
+ let(:params) { {} }
+
+ it { is_expected.to compile.with_all_deps }
+
+ it do
+ is_expected.to create_file(file_periodic).with(
+ owner: 'root',
+ group: 'root',
+ mode: '0644'
+ ).with_content(
+ /APT::Periodic::Enable "1";/
+ ).with_content(
+ /APT::Periodic::BackupArchiveInterval "0";/
+ ).with_content(
+ /APT::Periodic::BackupLevel "3";/
+ ).with_content(
+ /APT::Periodic::MaxAge "0";/
+ ).with_content(
+ /APT::Periodic::MinAge "2";/
+ ).with_content(
+ /APT::Periodic::MaxSize "0";/
+ ).with_content(
+ /APT::Periodic::Update-Package-Lists "1";/
+ ).with_content(
+ /APT::Periodic::Download-Upgradeable-Packages "0";/
+ ).with_content(
+ /APT::Periodic::Download-Upgradeable-Packages-Debdelta "1";/
+ ).with_content(
+ /APT::Periodic::Unattended-Upgrade "1";/
+ ).with_content(
+ /APT::Periodic::AutocleanInterval "0";/
+ ).with_content(
+ /APT::Periodic::Verbose "0";/
+ )
+ end
+
+ it do
+ is_expected.to contain_apt__conf('auto-upgrades').with(
+ ensure: 'absent'
+ )
+ end
+ it do
+ is_expected.to create_file(file_options).with(
+ owner: 'root',
+ group: 'root',
+ mode: '0644'
+ ).with_content(
+ /^Dpkg::Options\s{/
+ ).with_content(
+ /^\s+\"--force-confdef\";/
+ ).with_content(
+ /^\s+\"--force-confold\";/
+ ).without_content(
+ /\"--force-confnew\";/
+ ).without_content(
+ /\"--force-confmiss\";/
+ )
+ end
+ end
+
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge(fqdn: 'unattended-upgrades.example.com',
+ path: '/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin:/root/bin')
+ end
+
+ case facts[:operatingsystem]
+ when 'Debian'
+ it_behaves_like 'Debian specs'
+ case facts[:lsbdistcodename]
+ when 'squeeze'
+ context 'with defaults on Debian 6 Squeeze' do
+ it do
+ is_expected.to create_file(file_unattended).with(
+ owner: 'root',
+ group: 'root',
+ mode: '0644'
+ ).with_content(
+ # This section varies for different releases
+ /\Unattended-Upgrade::Allowed-Origins\ {\n
+ \t"\${distro_id}\ \${distro_codename}-security";\n
+ \t"\${distro_id}\ \${distro_codename}-lts";\n
+ };/x
+ )
+ end
+ end
+ when 'wheezy'
+ context 'with defaults on Debian 7 wheezy' do
+ it do
+ is_expected.to create_file(file_unattended).with(
+ owner: 'root',
+ group: 'root',
+ mode: '0644'
+ ).with_content(
+ # This section varies for different releases
+ /\Unattended-Upgrade::Origins-Pattern\ {\n
+ \t"origin=Debian,archive=oldoldstable,label=Debian-Security";\n
+ };/x
+ )
+ end
+ end
+ when 'jessie'
+ context 'with defaults on Debian 8 Jessie' do
+ it do
+ is_expected.to create_file(file_unattended).with(
+ owner: 'root',
+ group: 'root',
+ mode: '0644'
+ ).with_content(
+ # This section varies for different releases
+ /\Unattended-Upgrade::Origins-Pattern\ {\n
+ \t"origin=Debian,archive=oldstable,label=Debian-Security";\n
+ };/x
+ )
+ end
+ end
+ end
+ when 'stretch'
+ context 'with defaults on Debian 9 Stretch' do
+ it do
+ is_expected.to create_file(file_unattended).with(
+ owner: 'root',
+ group: 'root',
+ mode: '0644'
+ ).with_content(
+ # This section varies for different releases
+ /\Unattended-Upgrade::Origins-Pattern\ {\n
+ \t"origin=Debian,archive=oldstable,label=Debian-Security";\n
+ };/x
+ )
+ end
+ end
+ end
+ end
+ end
+end