Skip to content

Commit

Permalink
Merge pull request #686 from wyardley/issues_684
Browse files Browse the repository at this point in the history
Install package via title, not name (#684)
  • Loading branch information
wyardley authored Mar 14, 2018
2 parents 5b7f61f + ca32a67 commit b305696
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,11 @@
case $facts['os']['family'] {
'RedHat': {
contain rabbitmq::repo::rhel
Class['rabbitmq::repo::rhel'] -> Class['rabbitmq::install']
}
'Debian': {
contain rabbitmq::repo::apt
Class['rabbitmq::repo::apt'] -> Class['rabbitmq::install']
}
default: {
}
Expand Down
5 changes: 2 additions & 3 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
$package_name = $rabbitmq::package_name
$rabbitmq_group = $rabbitmq::rabbitmq_group

package { 'rabbitmq-server':
package { $package_name:
ensure => $package_ensure,
name => $package_name,
notify => Class['rabbitmq::service'],
}

Expand All @@ -18,7 +17,7 @@
owner => 'root',
group => $rabbitmq_group,
mode => '0775',
require => Package['rabbitmq-server'],
require => Package[$package_name],
}
}
}
1 change: 0 additions & 1 deletion manifests/repo/apt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# ordering / ensure to get the last version of repository
Class['rabbitmq::repo::apt']
-> Class['apt::update']
-> Package<| title == 'rabbitmq-server' |>

$osname = downcase($facts['os']['name'])
apt::source { 'rabbitmq':
Expand Down
2 changes: 0 additions & 2 deletions manifests/repo/rhel.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
String $key_source = $rabbitmq::package_gpg_key,
) {

Class['rabbitmq::repo::rhel'] -> Package<| title == 'rabbitmq-server' |>

yumrepo { 'rabbitmq':
ensure => present,
name => 'rabbitmq_rabbitmq-server',
Expand Down
6 changes: 6 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
"16.04"
]
},
{
"operatingsystem": "SLES",
"operatingsystemrelease": [
"11"
]
},
{
"operatingsystem": "FreeBSD"
},
Expand Down
5 changes: 4 additions & 1 deletion spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
it { is_expected.to contain_class('rabbitmq::config') }
it { is_expected.to contain_class('rabbitmq::service') }

it { is_expected.to contain_package('rabbitmq-server').with_ensure('installed').with_name(packagename) }
it { is_expected.to contain_package(packagename).with_ensure('installed').with_name(packagename) }
if facts[:os]['family'] == 'Suse'
it { is_expected.to contain_package('rabbitmq-server-plugins') }
end

context 'with default params' do
it { is_expected.not_to contain_class('rabbitmq::repo::apt') }
Expand Down

0 comments on commit b305696

Please sign in to comment.