Skip to content

Commit 363405b

Browse files
authored
Merge pull request #170 from ekohl/cleanup-repo
Remove 3.8 repo, use pl-apt 4.4 https support, clean coding
2 parents 8104d7b + d8fc721 commit 363405b

File tree

4 files changed

+28
-60
lines changed

4 files changed

+28
-60
lines changed

manifests/repo/apt.pp

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,44 +31,34 @@
3131
# Copyright 2015 RL Solutions, unless otherwise noted
3232
#
3333
class gluster::repo::apt (
34-
$version = $::gluster::params::version,
35-
$release = $::gluster::params::release,
36-
$priority = $::gluster::params::repo_priority,
34+
$version = $::gluster::params::version,
35+
$release = $::gluster::params::release,
36+
$priority = $::gluster::params::repo_priority,
3737
) {
3838
include '::apt'
3939

40-
ensure_packages(['apt-transport-https'], {'ensure' => 'present'})
41-
42-
# Key has changed since 3.9
4340
$repo_key_name = $release ? {
44-
'3.8' => 'A4703C37D3F4DE7F1819E980FE79BB52D5DC52DC',
45-
'3.10' => 'C784DD0FD61E38B8B1F65E10DAD761554A72C1DF',
46-
'3.11' => 'DE82F0BACC4DB70DBEF95CA65EC2255642304A6E',
47-
'3.12' => '8B7C364430B66F0B084C0B0C55339A4C6A7BD8D4',
48-
'3.13' => '9B5AE8E6FD2581F293104ACC38675E5F30F779AF',
49-
'4.0' => '55F839E173AC06F364120D46FA86EEACB306CEE1',
50-
'4.1' => 'EED3351AFD72E5437C050F0388F6CDEE78FA6D97',
51-
'^5\.(\d)+$' => 'F9C958A3AEE0D2184FAD1CBD43607F0DC2F8238C',
52-
default => '849512C2CA648EF425048F55C883F50CB2289A17',
41+
'3.10' => 'C784DD0FD61E38B8B1F65E10DAD761554A72C1DF',
42+
'3.11' => 'DE82F0BACC4DB70DBEF95CA65EC2255642304A6E',
43+
'3.12' => '8B7C364430B66F0B084C0B0C55339A4C6A7BD8D4',
44+
'3.13' => '9B5AE8E6FD2581F293104ACC38675E5F30F779AF',
45+
'4.0' => '55F839E173AC06F364120D46FA86EEACB306CEE1',
46+
'4.1' => 'EED3351AFD72E5437C050F0388F6CDEE78FA6D97',
47+
'^5\.(\d)+$' => 'F9C958A3AEE0D2184FAD1CBD43607F0DC2F8238C',
48+
default => '849512C2CA648EF425048F55C883F50CB2289A17',
5349
}
5450

55-
# Key location is different for some releases
56-
$repo_key_source = $release ? {
57-
'3.8' => "https://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/rsa.pub",
58-
default => "https://download.gluster.org/pub/gluster/glusterfs/${release}/rsa.pub",
59-
}
51+
$repo_key_source = "https://download.gluster.org/pub/gluster/glusterfs/${release}/rsa.pub"
6052

6153
# basic sanity check
6254
if $version == 'LATEST' {
6355
$repo_ver = $version
56+
} elsif $version =~ /^\d\.\d+$/ {
57+
$repo_ver = "${version}/LATEST"
58+
} elsif $version =~ /^(\d)\.(\d+)\.(\d+).*$/ {
59+
$repo_ver = "${1}.${2}/${1}.${2}.${3}"
6460
} else {
65-
if $version =~ /^\d\.\d+$/ {
66-
$repo_ver = "${version}/LATEST"
67-
} elsif $version =~ /^(\d)\.(\d+)\.(\d+).*$/ {
68-
$repo_ver = "${1}.${2}/${1}.${2}.${3}"
69-
} else {
70-
fail("${version} doesn't make sense for ${::operatingsystem}!")
71-
}
61+
fail("${version} doesn't make sense for ${::operatingsystem}!")
7262
}
7363

7464
# the Gluster repo only supports x86_64 and i386. armhf is only supported for Raspbian. The Ubuntu PPA also supports armhf and arm64.
@@ -82,9 +72,9 @@
8272
default => false,
8373
}
8474
if versioncmp($release, '3.12') < 0 {
85-
$repo_url = "http://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/Debian/${::lsbdistcodename}/apt/"
75+
$repo_url = "https://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/Debian/${::lsbdistcodename}/apt/"
8676
} else {
87-
$repo_url = "http://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/Debian/${::lsbdistcodename}/${arch}/apt/"
77+
$repo_url = "https://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/Debian/${::lsbdistcodename}/${arch}/apt/"
8878
}
8979
}
9080
}

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"dependencies": [
4141
{
4242
"name": "puppetlabs/apt",
43-
"version_requirement": ">= 2.1.0 < 7.0.0"
43+
"version_requirement": ">= 4.4.0 < 7.0.0"
4444
},
4545
{
4646
"name": "puppetlabs/stdlib",

spec/classes/init_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
context 'Debian specific stuff' do
7070
it { is_expected.to contain_class('gluster::repo::apt') }
7171
it { is_expected.to contain_apt__source('glusterfs-LATEST') }
72-
it { is_expected.to contain_package('apt-transport-https') }
7372
it 'creates gluster::install' do
7473
is_expected.to create_class('gluster::install').with(
7574
server: true,

spec/classes/repo_apt_spec.rb

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
is_expected.to contain_apt__source('glusterfs-LATEST').with(
2020
repos: 'main',
2121
release: facts[:lsbdistcodename].to_s,
22-
location: "http://download.gluster.org/pub/gluster/glusterfs/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/"
22+
location: "https://download.gluster.org/pub/gluster/glusterfs/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/"
2323
)
2424
end
2525
end
@@ -47,7 +47,7 @@
4747
is_expected.to contain_apt__source('glusterfs-LATEST').with(
4848
repos: 'main',
4949
release: facts[:lsbdistcodename].to_s,
50-
location: "http://download.gluster.org/pub/gluster/glusterfs/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/",
50+
location: "https://download.gluster.org/pub/gluster/glusterfs/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/",
5151
pin: '700'
5252
)
5353
end
@@ -68,15 +68,15 @@
6868
'id' => 'EED3351AFD72E5437C050F0388F6CDEE78FA6D97',
6969
'key_source' => 'https://download.gluster.org/pub/gluster/glusterfs/4.1/rsa.pub'
7070
},
71-
location: "http://download.gluster.org/pub/gluster/glusterfs/4.1/LATEST/Debian/#{facts[:lsbdistcodename]}/amd64/apt/"
71+
location: "https://download.gluster.org/pub/gluster/glusterfs/4.1/LATEST/Debian/#{facts[:lsbdistcodename]}/amd64/apt/"
7272
)
7373
end
7474
end
7575

76-
context 'Specific Gluster release 3.9' do
76+
context 'Specific Gluster release 3.12' do
7777
let :params do
7878
{
79-
release: '3.9'
79+
release: '3.12'
8080
}
8181
end
8282

@@ -85,34 +85,13 @@
8585
repos: 'main',
8686
release: facts[:lsbdistcodename].to_s,
8787
key: {
88-
'id' => '849512C2CA648EF425048F55C883F50CB2289A17',
89-
'key_source' => 'https://download.gluster.org/pub/gluster/glusterfs/3.9/rsa.pub'
88+
'id' => '8B7C364430B66F0B084C0B0C55339A4C6A7BD8D4',
89+
'key_source' => 'https://download.gluster.org/pub/gluster/glusterfs/3.12/rsa.pub'
9090
},
91-
location: "http://download.gluster.org/pub/gluster/glusterfs/3.9/LATEST/Debian/#{facts[:lsbdistcodename]}/apt/"
91+
location: "https://download.gluster.org/pub/gluster/glusterfs/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/amd64/apt/"
9292
)
9393
end
9494
end
95-
96-
context 'Specific Gluster release 3.8' do
97-
let :params do
98-
{
99-
release: '3.8'
100-
}
101-
end
102-
103-
it 'installs' do
104-
is_expected.to contain_apt__source('glusterfs-LATEST').with(
105-
repos: 'main',
106-
release: facts[:lsbdistcodename].to_s,
107-
key: {
108-
'id' => 'A4703C37D3F4DE7F1819E980FE79BB52D5DC52DC',
109-
'key_source' => 'https://download.gluster.org/pub/gluster/glusterfs/3.8/LATEST/rsa.pub'
110-
},
111-
location: "http://download.gluster.org/pub/gluster/glusterfs/3.8/LATEST/Debian/#{facts[:lsbdistcodename]}/apt/"
112-
)
113-
end
114-
end
115-
11695
end
11796
end
11897
end

0 commit comments

Comments
 (0)