Skip to content

Commit

Permalink
Merge pull request #170 from ekohl/cleanup-repo
Browse files Browse the repository at this point in the history
Remove 3.8 repo, use pl-apt 4.4 https support, clean coding
  • Loading branch information
bastelfreak authored Dec 28, 2018
2 parents 8104d7b + d8fc721 commit 363405b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 60 deletions.
48 changes: 19 additions & 29 deletions manifests/repo/apt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,44 +31,34 @@
# Copyright 2015 RL Solutions, unless otherwise noted
#
class gluster::repo::apt (
$version = $::gluster::params::version,
$release = $::gluster::params::release,
$priority = $::gluster::params::repo_priority,
$version = $::gluster::params::version,
$release = $::gluster::params::release,
$priority = $::gluster::params::repo_priority,
) {
include '::apt'

ensure_packages(['apt-transport-https'], {'ensure' => 'present'})

# Key has changed since 3.9
$repo_key_name = $release ? {
'3.8' => 'A4703C37D3F4DE7F1819E980FE79BB52D5DC52DC',
'3.10' => 'C784DD0FD61E38B8B1F65E10DAD761554A72C1DF',
'3.11' => 'DE82F0BACC4DB70DBEF95CA65EC2255642304A6E',
'3.12' => '8B7C364430B66F0B084C0B0C55339A4C6A7BD8D4',
'3.13' => '9B5AE8E6FD2581F293104ACC38675E5F30F779AF',
'4.0' => '55F839E173AC06F364120D46FA86EEACB306CEE1',
'4.1' => 'EED3351AFD72E5437C050F0388F6CDEE78FA6D97',
'^5\.(\d)+$' => 'F9C958A3AEE0D2184FAD1CBD43607F0DC2F8238C',
default => '849512C2CA648EF425048F55C883F50CB2289A17',
'3.10' => 'C784DD0FD61E38B8B1F65E10DAD761554A72C1DF',
'3.11' => 'DE82F0BACC4DB70DBEF95CA65EC2255642304A6E',
'3.12' => '8B7C364430B66F0B084C0B0C55339A4C6A7BD8D4',
'3.13' => '9B5AE8E6FD2581F293104ACC38675E5F30F779AF',
'4.0' => '55F839E173AC06F364120D46FA86EEACB306CEE1',
'4.1' => 'EED3351AFD72E5437C050F0388F6CDEE78FA6D97',
'^5\.(\d)+$' => 'F9C958A3AEE0D2184FAD1CBD43607F0DC2F8238C',
default => '849512C2CA648EF425048F55C883F50CB2289A17',
}

# Key location is different for some releases
$repo_key_source = $release ? {
'3.8' => "https://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/rsa.pub",
default => "https://download.gluster.org/pub/gluster/glusterfs/${release}/rsa.pub",
}
$repo_key_source = "https://download.gluster.org/pub/gluster/glusterfs/${release}/rsa.pub"

# basic sanity check
if $version == 'LATEST' {
$repo_ver = $version
} elsif $version =~ /^\d\.\d+$/ {
$repo_ver = "${version}/LATEST"
} elsif $version =~ /^(\d)\.(\d+)\.(\d+).*$/ {
$repo_ver = "${1}.${2}/${1}.${2}.${3}"
} else {
if $version =~ /^\d\.\d+$/ {
$repo_ver = "${version}/LATEST"
} elsif $version =~ /^(\d)\.(\d+)\.(\d+).*$/ {
$repo_ver = "${1}.${2}/${1}.${2}.${3}"
} else {
fail("${version} doesn't make sense for ${::operatingsystem}!")
}
fail("${version} doesn't make sense for ${::operatingsystem}!")
}

# the Gluster repo only supports x86_64 and i386. armhf is only supported for Raspbian. The Ubuntu PPA also supports armhf and arm64.
Expand All @@ -82,9 +72,9 @@
default => false,
}
if versioncmp($release, '3.12') < 0 {
$repo_url = "http://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/Debian/${::lsbdistcodename}/apt/"
$repo_url = "https://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/Debian/${::lsbdistcodename}/apt/"
} else {
$repo_url = "http://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/Debian/${::lsbdistcodename}/${arch}/apt/"
$repo_url = "https://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/Debian/${::lsbdistcodename}/${arch}/apt/"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dependencies": [
{
"name": "puppetlabs/apt",
"version_requirement": ">= 2.1.0 < 7.0.0"
"version_requirement": ">= 4.4.0 < 7.0.0"
},
{
"name": "puppetlabs/stdlib",
Expand Down
1 change: 0 additions & 1 deletion spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
context 'Debian specific stuff' do
it { is_expected.to contain_class('gluster::repo::apt') }
it { is_expected.to contain_apt__source('glusterfs-LATEST') }
it { is_expected.to contain_package('apt-transport-https') }
it 'creates gluster::install' do
is_expected.to create_class('gluster::install').with(
server: true,
Expand Down
37 changes: 8 additions & 29 deletions spec/classes/repo_apt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
is_expected.to contain_apt__source('glusterfs-LATEST').with(
repos: 'main',
release: facts[:lsbdistcodename].to_s,
location: "http://download.gluster.org/pub/gluster/glusterfs/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/"
location: "https://download.gluster.org/pub/gluster/glusterfs/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/"
)
end
end
Expand Down Expand Up @@ -47,7 +47,7 @@
is_expected.to contain_apt__source('glusterfs-LATEST').with(
repos: 'main',
release: facts[:lsbdistcodename].to_s,
location: "http://download.gluster.org/pub/gluster/glusterfs/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/",
location: "https://download.gluster.org/pub/gluster/glusterfs/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/#{facts[:architecture]}/apt/",
pin: '700'
)
end
Expand All @@ -68,15 +68,15 @@
'id' => 'EED3351AFD72E5437C050F0388F6CDEE78FA6D97',
'key_source' => 'https://download.gluster.org/pub/gluster/glusterfs/4.1/rsa.pub'
},
location: "http://download.gluster.org/pub/gluster/glusterfs/4.1/LATEST/Debian/#{facts[:lsbdistcodename]}/amd64/apt/"
location: "https://download.gluster.org/pub/gluster/glusterfs/4.1/LATEST/Debian/#{facts[:lsbdistcodename]}/amd64/apt/"
)
end
end

context 'Specific Gluster release 3.9' do
context 'Specific Gluster release 3.12' do
let :params do
{
release: '3.9'
release: '3.12'
}
end

Expand All @@ -85,34 +85,13 @@
repos: 'main',
release: facts[:lsbdistcodename].to_s,
key: {
'id' => '849512C2CA648EF425048F55C883F50CB2289A17',
'key_source' => 'https://download.gluster.org/pub/gluster/glusterfs/3.9/rsa.pub'
'id' => '8B7C364430B66F0B084C0B0C55339A4C6A7BD8D4',
'key_source' => 'https://download.gluster.org/pub/gluster/glusterfs/3.12/rsa.pub'
},
location: "http://download.gluster.org/pub/gluster/glusterfs/3.9/LATEST/Debian/#{facts[:lsbdistcodename]}/apt/"
location: "https://download.gluster.org/pub/gluster/glusterfs/3.12/LATEST/Debian/#{facts[:lsbdistcodename]}/amd64/apt/"
)
end
end

context 'Specific Gluster release 3.8' do
let :params do
{
release: '3.8'
}
end

it 'installs' do
is_expected.to contain_apt__source('glusterfs-LATEST').with(
repos: 'main',
release: facts[:lsbdistcodename].to_s,
key: {
'id' => 'A4703C37D3F4DE7F1819E980FE79BB52D5DC52DC',
'key_source' => 'https://download.gluster.org/pub/gluster/glusterfs/3.8/LATEST/rsa.pub'
},
location: "http://download.gluster.org/pub/gluster/glusterfs/3.8/LATEST/Debian/#{facts[:lsbdistcodename]}/apt/"
)
end
end

end
end
end
Expand Down

0 comments on commit 363405b

Please sign in to comment.