Skip to content

Commit

Permalink
Merge pull request voxpupuli#140 from robocoder/manage-repos-patch
Browse files Browse the repository at this point in the history
manage_repos
  • Loading branch information
hunner committed Jan 24, 2014
2 parents 0e30a57 + 6b8c64a commit 015bd78
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
18 changes: 11 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
$package_name = $rabbitmq::params::package_name,
$package_provider = $rabbitmq::params::package_provider,
$package_source = $rabbitmq::params::package_source,
$manage_repos = $rabbitmq::params::manage_repos,
$plugin_dir = $rabbitmq::params::plugin_dir,
$port = $rabbitmq::params::port,
$service_ensure = $rabbitmq::params::service_ensure,
Expand Down Expand Up @@ -60,6 +61,7 @@
validate_string($package_name)
validate_string($package_provider)
validate_string($package_source)
validate_bool($manage_repos)
validate_re($version, '^\d+\.\d+\.\d+(-\d+)*$') # Allow 3 digits and optional -n postfix.
# Validate config parameters.
validate_array($cluster_disk_nodes)
Expand Down Expand Up @@ -110,13 +112,15 @@
include '::rabbitmq::service'
include '::rabbitmq::management'

case $::osfamily {
'RedHat', 'SUSE':
{ include '::rabbitmq::repo::rhel' }
'Debian':
{ include '::rabbitmq::repo::apt' }
default:
{ }
if $rabbitmq::manage_repos == true {
case $::osfamily {
'RedHat', 'SUSE':
{ include '::rabbitmq::repo::rhel' }
'Debian':
{ include '::rabbitmq::repo::apt' }
default:
{ }
}
}

if $admin_enable and $service_manage {
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
$management_port = '15672'
$package_apt_pin = ''
$package_gpg_key = 'http://www.rabbitmq.com/rabbitmq-signing-key-public.asc'
$manage_repos = true
$service_ensure = 'running'
$service_manage = true
#config
Expand Down
19 changes: 18 additions & 1 deletion spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,30 @@
end
end
end

context 'on Debian' do
let(:params) {{ :manage_repos => false }}
let(:facts) {{ :osfamily => 'Debian', :lsbdistcodename => 'squeeze' }}
it 'does not include rabbitmq::repo::apt when manage_repos is false' do
should_not contain_class('rabbitmq::repo::apt')
end
end

context 'on Redhat' do
let(:facts) {{ :osfamily => 'RedHat' }}
it 'includes rabbitmq::repo::rhel' do
should contain_class('rabbitmq::repo::rhel')
end
end


context 'on Redhat' do
let(:params) {{ :manage_repos => false }}
let(:facts) {{ :osfamily => 'RedHat' }}
it 'does not include rabbitmq::repo::rhel when manage_repos is false' do
should_not contain_class('rabbitmq::repo::rhel')
end
end

['Debian', 'RedHat', 'SUSE', 'Archlinux'].each do |distro|
context "on #{distro}" do
let(:facts) {{
Expand Down

0 comments on commit 015bd78

Please sign in to comment.