Skip to content

Commit 8eb98e5

Browse files
authored
Merge pull request #1142 from evgeni/cleanup-debian-9
Cleanup Debian 9 and Ubuntu pre-18.04 specialcases
2 parents f9be175 + 776d7b4 commit 8eb98e5

File tree

5 files changed

+10
-104
lines changed

5 files changed

+10
-104
lines changed

manifests/init.pp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,10 @@
391391

392392
case $facts['os']['name'] {
393393
'Debian': {
394-
if versioncmp($facts['os']['release']['major'], '9') >= 0 {
395-
stdlib::ensure_packages(['gnupg'])
396-
}
394+
stdlib::ensure_packages(['gnupg'])
397395
}
398396
'Ubuntu': {
399-
if versioncmp($facts['os']['release']['full'], '17.04') >= 0 {
400-
stdlib::ensure_packages(['gnupg'])
401-
}
397+
stdlib::ensure_packages(['gnupg'])
402398
}
403399
default: {
404400
# Nothing in here

manifests/key.pp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,12 @@
6464

6565
case $facts['os']['name'] {
6666
'Debian': {
67-
if versioncmp($facts['os']['release']['major'], '9') >= 0 {
68-
stdlib::ensure_packages(['gnupg'])
69-
Apt::Key<| title == $title |>
70-
}
67+
stdlib::ensure_packages(['gnupg'])
68+
Apt::Key<| title == $title |>
7169
}
7270
'Ubuntu': {
73-
if versioncmp($facts['os']['release']['full'], '17.04') >= 0 {
74-
stdlib::ensure_packages(['gnupg'])
75-
Apt::Key<| title == $title |>
76-
}
71+
stdlib::ensure_packages(['gnupg'])
72+
Apt::Key<| title == $title |>
7773
}
7874
default: {
7975
# Nothing in here

manifests/ppa.pp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,9 @@
4444
fail("Invalid PPA name: ${name}")
4545
}
4646

47-
if versioncmp($facts['os']['release']['full'], '14.10') >= 0 {
48-
$distid = downcase($dist)
49-
$dash_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1-${distid}-\\2")
50-
$underscore_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1_${distid}_\\2")
51-
} else {
52-
$dash_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1-\\2")
53-
$underscore_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1_\\2")
54-
}
47+
$distid = downcase($dist)
48+
$dash_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1-${distid}-\\2")
49+
$underscore_filename = regsubst($name, '^ppa:([^/]+)/(.+)$', "\\1_${distid}_\\2")
5550

5651
$dash_filename_no_slashes = regsubst($dash_filename, '/', '-', 'G')
5752
$dash_filename_no_specialchars = regsubst($dash_filename_no_slashes, '[\.\+]', '_', 'G')
@@ -60,8 +55,7 @@
6055

6156
$sources_list_d_filename = "${dash_filename_no_specialchars}-${release}.list"
6257

63-
if versioncmp($facts['os']['release']['full'], '15.10') >= 0 and
64-
versioncmp($facts['os']['release']['full'], '21.04') < 0 {
58+
if versioncmp($facts['os']['release']['full'], '21.04') < 0 {
6559
$trusted_gpg_d_filename = "${underscore_filename_no_specialchars}.gpg"
6660
} else {
6761
$trusted_gpg_d_filename = "${dash_filename_no_specialchars}.gpg"

manifests/source.pp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,6 @@
125125
else {
126126
$_location = $location
127127
}
128-
# Newer oses, do not need the package for HTTPS transport.
129-
$_transport_https_releases = ['9']
130-
if (fact('os.release.major') in $_transport_https_releases) and $_location =~ /(?i:^https:\/\/)/ {
131-
stdlib::ensure_packages('apt-transport-https')
132-
Package['apt-transport-https'] -> Class['apt::update']
133-
}
134128
} else {
135129
$_location = undef
136130
}

spec/defines/source_spec.rb

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636
it {
3737
expect(subject).to contain_apt__setting('list-my_source').with(ensure: 'present').without_content(%r{# my_source\ndeb-src hello.there wheezy main\n})
38-
expect(subject).not_to contain_package('apt-transport-https')
3938
}
4039
end
4140
end
@@ -223,79 +222,6 @@
223222
}
224223
end
225224

226-
context 'with a https location, install apt-transport-https' do
227-
let :params do
228-
{
229-
location: 'HTTPS://foo.bar',
230-
allow_unsigned: false
231-
}
232-
end
233-
234-
it {
235-
expect(subject).to contain_package('apt-transport-https')
236-
}
237-
end
238-
239-
context 'with a https location and custom release, install apt-transport-https' do
240-
let :facts do
241-
{
242-
os: {
243-
family: 'Debian',
244-
name: 'Debian',
245-
release: {
246-
major: '9',
247-
full: '9.0'
248-
},
249-
distro: {
250-
codename: 'stretch',
251-
id: 'Debian'
252-
}
253-
},
254-
puppetversion: Puppet.version
255-
}
256-
end
257-
let :params do
258-
{
259-
location: 'HTTPS://foo.bar',
260-
allow_unsigned: false,
261-
release: 'customrelease'
262-
}
263-
end
264-
265-
it {
266-
expect(subject).to contain_package('apt-transport-https')
267-
}
268-
end
269-
270-
context 'with a https location, do not install apt-transport-https on oses not in list eg buster' do
271-
let :facts do
272-
{
273-
os: {
274-
family: 'Debian',
275-
name: 'Debian',
276-
release: {
277-
major: '10',
278-
full: '10.0'
279-
},
280-
distro: {
281-
codename: 'buster',
282-
id: 'Debian'
283-
}
284-
}
285-
}
286-
end
287-
let :params do
288-
{
289-
location: 'https://foo.bar',
290-
allow_unsigned: false
291-
}
292-
end
293-
294-
it {
295-
expect(subject).not_to contain_package('apt-transport-https')
296-
}
297-
end
298-
299225
context 'with architecture equals x86_64' do
300226
let :facts do
301227
{

0 commit comments

Comments
 (0)