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

(GH-iac-334) Remove code specific to unsupported OSs #1024

Merged
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
12 changes: 2 additions & 10 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@
}
$ppa_options = undef
$ppa_package = undef
if versioncmp($facts['os']['release']['major'], '9') >= 0 {
$auth_conf_owner = '_apt'
} else {
$auth_conf_owner = 'root'
}
$auth_conf_owner = '_apt'
}
'Ubuntu': {
$backports = {
Expand All @@ -98,11 +94,7 @@
}
$ppa_options = '-y'
$ppa_package = 'software-properties-common'
if versioncmp($facts['os']['release']['full'], '16.04') >= 0 {
$auth_conf_owner = '_apt'
} else {
$auth_conf_owner = 'root'
}
$auth_conf_owner = '_apt'
}
undef: {
fail('Unable to determine value for fact os[\"name\"]')
Expand Down
8 changes: 4 additions & 4 deletions manifests/source.pp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
$_location = $location
}
# Newer oses, do not need the package for HTTPS transport.
$_transport_https_releases = [ '7', '8', '9', '14.04', '16.04' ]
$_transport_https_releases = ['9']
if (fact('os.release.major') in $_transport_https_releases) and $_location =~ /(?i:^https:\/\/)/ {
ensure_packages('apt-transport-https')
Package['apt-transport-https'] -> Class['apt::update']
Expand All @@ -111,7 +111,7 @@
$includes = merge($::apt::include_defaults, $include)

if $key and $keyring {
fail("parameters key and keyring are mutualy exclusive")
fail('parameters key and keyring are mutualy exclusive')
}

if $key {
Expand All @@ -138,8 +138,8 @@
'includes' => $includes,
'options' => delete_undef_values({
'arch' => $architecture,
'trusted' => $allow_unsigned ? {true => "yes", false => undef},
'allow-insecure' => $allow_insecure ? {true => "yes", false => undef},
'trusted' => $allow_unsigned ? {true => 'yes', false => undef},
'allow-insecure' => $allow_insecure ? {true => 'yes', false => undef},
'signed-by' => $keyring,
}),
'location' => $_location,
Expand Down
6 changes: 1 addition & 5 deletions provision.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
default:
provisioner: docker
images:
- litmusimage/debian:8
- litmusimage/debian:9
vagrant:
provisioner: vagrant
images:
Expand All @@ -16,7 +16,6 @@ travis_deb:
travis_ub_6:
provisioner: docker
images:
- litmusimage/ubuntu:16.04
- litmusimage/ubuntu:18.04
- litmusimage/ubuntu:20.04
travis_el7:
Expand All @@ -25,11 +24,8 @@ travis_el7:
release_checks_6:
provisioner: abs
images:
- debian-8-x86_64
- debian-9-x86_64
- debian-10-x86_64
- ubuntu-1404-x86_64
- ubuntu-1604-x86_64
- ubuntu-1804-x86_64
- ubuntu-2004-x86_64
release_checks_7:
Expand Down
19 changes: 5 additions & 14 deletions spec/acceptance/apt_key_provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
KEY_CHECK_COMMAND = 'apt-key adv --no-tty --list-keys --with-colons --fingerprint | grep '
PUPPETLABS_KEY_CHECK_COMMAND = "#{KEY_CHECK_COMMAND} #{PUPPETLABS_GPG_KEY_FINGERPRINT}"
CENTOS_KEY_CHECK_COMMAND = "#{KEY_CHECK_COMMAND} #{CENTOS_GPG_KEY_FINGERPRINT}"
PUPPETLABS_EXP_CHECK_COMMAND = "#{KEY_CHECK_COMMAND} '#{PUPPETLABS_EXP_KEY_DATES}'"
DEBIAN_PUPPETLABS_EXP_CHECK_COMMAND = 'apt-key list | grep -F -A 1 \'pub rsa4096 2010-07-10 [SC] [expired: 2017-01-05]\' | grep \'47B3 20EB 4C7C 375A A9DA E1A0 1054 B7A2 4BD6 EC30\''
PUPPETLABS_EXP_CHECK_COMMAND = 'apt-key list | grep -F -A 1 \'pub rsa4096 2010-07-10 [SC] [expired: 2017-01-05]\' | grep \'47B3 20EB 4C7C 375A A9DA E1A0 1054 B7A2 4BD6 EC30\''

def install_key(key)
retry_on_error_matching do
Expand Down Expand Up @@ -890,17 +889,9 @@ def apply_manifest_twice(manifest_pp)
end

describe 'refresh' do
if ['8', '14.04', '16.04'].include?(host_inventory['facter']['os']['release']['major'])
# older OSes use puppetlabs_exp_check_command
let(:puppetlabs_exp_check_command) { PUPPETLABS_EXP_CHECK_COMMAND }
# Ensure dirmngr package is installed
apply_manifest(refresh_check_for_dirmngr_pp, acceptable_exit_codes: [0, 2])

else
# Set Debian Stetch and newer OSes puppetlabs_exp_check_command
let(:puppetlabs_exp_check_command) { DEBIAN_PUPPETLABS_EXP_CHECK_COMMAND }

# Ensure dirmngr package is installed
apply_manifest(refresh_check_for_dirmngr_pp, acceptable_exit_codes: [0, 2])
end
before(:each) do
# Delete the Puppet Labs Release Key and install an expired version of the key
apply_manifest(refresh_del_key_pp)
Expand All @@ -910,14 +901,14 @@ def apply_manifest_twice(manifest_pp)
it 'updates an expired key' do
apply_manifest(refresh_true_pp)
# Check key has been updated to new version
run_shell(puppetlabs_exp_check_command.to_s)
run_shell(PUPPETLABS_EXP_CHECK_COMMAND.to_s)
end
end
context 'when refresh => false' do
it 'does not replace an expired key' do
apply_manifest(refresh_false_pp)
# Expired key is present and has not been updated by the new version
run_shell(puppetlabs_exp_check_command.to_s, expect_failures: true)
run_shell(PUPPETLABS_EXP_CHECK_COMMAND.to_s, expect_failures: true)
end
end
end
Expand Down
38 changes: 19 additions & 19 deletions spec/classes/apt_backports_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
family: 'Debian',
name: 'Debian',
release: {
major: '8',
full: '8.0',
major: '9',
full: '9.0',
},
distro: {
codename: 'jessie',
codename: 'stretch',
id: 'Debian',
},
},
Expand All @@ -27,8 +27,8 @@
it {
is_expected.to contain_apt__source('backports').with(location: 'http://deb.debian.org/debian',
repos: 'main contrib non-free',
release: 'jessie-backports',
pin: { 'priority' => 200, 'release' => 'jessie-backports' })
release: 'stretch-backports',
pin: { 'priority' => 200, 'release' => 'stretch-backports' })
}
end
context 'with defaults on ubuntu' do
Expand All @@ -38,11 +38,11 @@
family: 'Debian',
name: 'Ubuntu',
release: {
major: '16',
full: '16.04',
major: '18',
full: '18.04',
},
distro: {
codename: 'xenial',
codename: 'bionac',
id: 'Ubuntu',
},
},
Expand All @@ -53,8 +53,8 @@
is_expected.to contain_apt__source('backports').with(location: 'http://archive.ubuntu.com/ubuntu',
key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
repos: 'main universe multiverse restricted',
release: 'xenial-backports',
pin: { 'priority' => 200, 'release' => 'xenial-backports' })
release: 'bionac-backports',
pin: { 'priority' => 200, 'release' => 'bionac-backports' })
}
end
context 'with everything set' do
Expand All @@ -64,11 +64,11 @@
family: 'Debian',
name: 'Ubuntu',
release: {
major: '16',
full: '16.04',
major: '18',
full: '18.04',
},
distro: {
codename: 'xenial',
codename: 'bionac',
id: 'Ubuntu',
},
},
Expand Down Expand Up @@ -99,11 +99,11 @@
family: 'Debian',
name: 'Ubuntu',
release: {
major: '16',
full: '16.04',
major: '18',
full: '18.04',
},
distro: {
codename: 'xenial',
codename: 'bionac',
id: 'Ubuntu',
},
},
Expand Down Expand Up @@ -222,11 +222,11 @@
family: 'Debian',
name: 'Ubuntu',
release: {
major: '16',
full: '16.04',
major: '18',
full: '18.04',
},
distro: {
codename: 'xenial',
codename: 'bionac',
id: 'Ubuntu',
},
},
Expand Down
Loading