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

Removing requirement for EPEL on RedHat/Centos and Erlang-solutions repository #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 0 additions & 10 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
# Defaults to present.
#
class erlang (
$epel_enable = $erlang::params::epel_enable,
$key_signature = $erlang::params::key_signature,
$local_repo_location = $erlang::params::local_repo_location,
$package_name = $erlang::params::package_name,
Expand All @@ -26,16 +25,7 @@
include '::erlang::repo::apt'
}
'RedHat' : {
if $epel_enable {
# Include epel as this is a requirement for erlang in RHEL6.
include '::epel'
Class['epel'] -> Package[$package_name]
}

# This is only needed on RHEL5, RHEL6 has erlang in EPEL.
if $::operatingsystemrelease =~ /^5/ {
include '::erlang::repo::yum'
}
}
default : {
}
Expand Down
5 changes: 2 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# operating systems
#
class erlang::params {
$epel_enable = false

case $::osfamily {
'Debian' : {
Expand All @@ -23,8 +22,8 @@
$local_repo_location = '/etc/yum.repos.d/epel-erlang.repo'
$remote_repo_location = 'https://repos.fedorapeople.org/repos/peter/erlang/epel-erlang.repo'
} else {
$local_repo_location = undef
$remote_repo_location = undef
$local_repo_location = '/etc/yum.repos.d/erlang-solutions.repo'
$remote_repo_location = 'http://packages.erlang-solutions.com/rpm/centos/erlang_solutions.repo'
}

$remote_repo_key_location = undef
Expand Down
8 changes: 5 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@
},
{
"name": "puppet",
"version_requirement": "3.x"
"version_requirement": [
"3.x",
"4.x"
]
}
],
"dependencies": [
{ "name": "puppetlabs/stdlib", "version_requirement": ">=2.0.0 <5.0.0" },
{ "name": "puppetlabs/apt", "version_requirement": ">=2.1.0" },
{ "name": "stahnma/epel", "version_requirement": ">=1.0.0 <2.0.0" }
{ "name": "puppetlabs/apt", "version_requirement": ">=2.1.0" }
]
}
37 changes: 17 additions & 20 deletions spec/classes/erlang_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@
context 'on RedHat 5' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystemrelease => '5.9' } }

context "epel enabled" do
let(:params) {{ :epel_enable => true }}
it { should contain_class('epel') }
end

context "epel disabled" do
let(:params) {{ :epel_enable => false }}
it { should_not contain_class('epel') }
end

context 'with no parameters' do
it { should contain_package('erlang').with_ensure('present') }
it { should contain_exec('erlang-repo-download').with(
Expand Down Expand Up @@ -90,25 +80,32 @@
context 'on RedHat 6' do
let(:facts) { {:osfamily => 'RedHat', :operatingsystemrelease => '6.4' } }

context "epel enabled" do
let(:params) {{ :epel_enable => true }}
it { should contain_class('epel') }
context 'with no parameters' do
it { should contain_package('erlang').with_ensure('present') }
it { should contain_exec('erlang-repo-download').with(
'command' => 'curl -o /etc/yum.repos.d/erlang-solutions.repo http://packages.erlang-solutions.com/rpm/centos/erlang_solutions.repo',
'path' => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
)
}
end

context "epel disabled" do
let(:params) {{ :epel_enable => false }}
it { should_not contain_class('epel') }
end
context 'with a custom repository' do
let(:params) { {
'local_repo_location' => '/tmp/yum.repos.d/tmp.repo',
'remote_repo_location' => 'http://example.com/fake.repo',
} }

context 'with no parameters' do
it { should contain_package('erlang').with_ensure('present') }
it { should contain_exec('erlang-repo-download').with(
'command' => 'curl -o /tmp/yum.repos.d/tmp.repo http://example.com/fake.repo'
)
}
end

context 'with a custom version' do
let(:params) { {'version' => 'absent' } }
it { should contain_package('erlang').with_ensure('absent') }
end
end
end

context 'on SUSE' do
let(:facts) {{ :osfamily => 'SUSE', }}
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@
puppet_install
puppet_module_install(:source => proj_root, :module_name => 'erlang')
shell('puppet module install puppetlabs-apt')
shell('puppet module install stahnma-epel')
end
end
4 changes: 1 addition & 3 deletions spec/system/erlang_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
describe 'The erlang puppet module' do
it 'should run without errors' do
pp = <<-EOS
class { 'erlang':
epel_enable => true
}
class { 'erlang': }
EOS

puppet_apply(pp) do |r|
Expand Down