Skip to content

Commit

Permalink
Merge pull request #103 from martialblog/repo_refactor
Browse files Browse the repository at this point in the history
Repo refactor to support different apt gpg key locations
  • Loading branch information
bastelfreak committed Feb 12, 2017
2 parents 12fb6e3 + 1ff0b31 commit 87e60f1
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 11 deletions.
8 changes: 2 additions & 6 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,10 @@
$service_name = 'glusterd'
}
'Debian': {
$repo = true
$repo_gpg_key_name = 'A4703C37D3F4DE7F1819E980FE79BB52D5DC52DC'
$repo_gpg_key_source = 'https://download.gluster.org/pub/gluster/glusterfs/LATEST/rsa.pub'

$repo = true
$server_package = 'glusterfs-server'
$client_package = 'glusterfs-client'

$service_name = 'glusterfs-server'
$service_name = 'glusterfs-server'
}
'Archlinux': {
$repo = false
Expand Down
18 changes: 15 additions & 3 deletions manifests/repo/apt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,24 @@
#
class gluster::repo::apt (
$version = $::gluster::params::version,
$repo_key_name = $::gluster::params::repo_gpg_key_name,
$repo_key_source = $::gluster::params::repo_gpg_key_source,
$release = $::gluster::params::release,
$priority = $::gluster::params::repo_priority,
) {
include '::apt'

# Key has changed since 3.9
$repo_key_name = $release ? {
/(3.0|3.1|3.2|3.3|3.4|3.5|3.6|3.7|3.8)/ => 'A4703C37D3F4DE7F1819E980FE79BB52D5DC52DC',
default => '849512C2CA648EF425048F55C883F50CB2289A17',
}

# Key location is different for some releases
$repo_key_source = $release ? {
/(3.0|3.1|3.2|3.3|3.4|3.5|3.7|3.8)/ => "https://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/rsa.pub",
'3.6' => "https://download.gluster.org/pub/gluster/glusterfs/${release}/LATEST/Debian/rsa.pub",
default => "https://download.gluster.org/pub/gluster/glusterfs/${release}/rsa.pub",
}

# basic sanity check
if $version == 'LATEST' {
$repo_ver = $version
Expand All @@ -61,7 +73,7 @@
/i\d86/ => 'i386',
default => false,
}
$repo_url = "http://download.gluster.org/pub/gluster/glusterfs/${repo_ver}/Debian/${::lsbdistcodename}/apt/"
$repo_url = "http://download.gluster.org/pub/gluster/glusterfs/${repo_ver}/LATEST/Debian/${::lsbdistcodename}/apt/"
}
}
}
Expand Down
62 changes: 60 additions & 2 deletions spec/classes/repo_apt_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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/LATEST/Debian/#{facts[:lsbdistcodename]}/apt/"
location: "http://download.gluster.org/pub/gluster/glusterfs/LATEST/LATEST/Debian/#{facts[:lsbdistcodename]}/apt/"
)
end
end
Expand All @@ -44,11 +44,69 @@
is_expected.to contain_apt__source('glusterfs-LATEST').with(
repos: 'main',
release: facts[:lsbdistcodename].to_s,
location: "http://download.gluster.org/pub/gluster/glusterfs/LATEST/Debian/#{facts[:lsbdistcodename]}/apt/",
location: "http://download.gluster.org/pub/gluster/glusterfs/LATEST/LATEST/Debian/#{facts[:lsbdistcodename]}/apt/",
pin: '700'
)
end
end

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

context 'Specific Gluster release 3.6' do
let :params do
{
release: '3.6'
}
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.6/LATEST/Debian/rsa.pub'
},
location: "http://download.gluster.org/pub/gluster/glusterfs/LATEST/LATEST/Debian/#{facts[:lsbdistcodename]}/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/LATEST/LATEST/Debian/#{facts[:lsbdistcodename]}/apt/"
)
end
end

end
end
end
Expand Down

0 comments on commit 87e60f1

Please sign in to comment.