voxpupuli / puppet-rabbitmq

RabbitMQ Puppet Module
http://forge.puppetlabs.com/puppet/rabbitmq
Apache License 2.0
172 stars 503 forks source link

puppet package install error when running on SLES 12 #684

Closed paebersold closed 6 years ago

paebersold commented 6 years ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

Using the default suse values from params.pp

What are you seeing

Error: Failed to apply catalog: Parameter name failed on Package[rabbitmq-server]: Name must be a String not Array at /etc/puppetlabs/code/environments/modules/rabbitmq/manifests/install.pp:9

What behaviour did you expect instead

package to be installed

Output log

as above

Any additional information you'd like to impart

The params.pp configuration for Suse has the packages defined as an array, not a string (https://github.com/voxpupuli/puppet-rabbitmq/pull/656). More recent (since 3.4 is appears - see https://groups.google.com/forum/#!topic/puppet-users/gxwDg8XUVqw) versions of puppet no longer allow this behaviour.

My workaround it to set the package list via hiera, ie rabbitmq::package_name: 'rabbitmq-server'

Note that I am using the openSUSE rabbitmq-server package from https://www.rabbitmq.com/install-rpm.html. There is no '-plugins' sub-package.

wyardley commented 6 years ago

This was added fairly recently, in #656 Unfortunately, we don't yet have working acceptance tests for SLES / openSUSE, though there was some discussion about it there. I did a quick pass at trying to get it to work a while back, but wasn't able to; the "quirky" versioning also didn't help.

FWIW, the change was added at a point where the module already didn't support Puppet 3.x. I can reproduce this error in the CentOS Vagrant box used for acceptance testing if I manually edit params to have an array for the package name.

I'm not sure if there's any reason something like this wouldn't work:

--- a/manifests/install.pp
+++ b/manifests/install.pp
@@ -6,9 +6,8 @@ class rabbitmq::install {
   $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'],
   }

From a quick test, that change does break some of the spec tests for Archlinux (because it has a different package name), so fixing this might involve some tweaks with that. Some more discussion on some unrelated Arch test failures in #683

https://github.com/voxpupuli/puppet-rabbitmq/blob/master/spec/classes/rabbitmq_spec.rb#L33 https://github.com/voxpupuli/puppet-rabbitmq/blob/master/spec/classes/rabbitmq_spec.rb#L140

wyardley commented 6 years ago

cc: @tampakrap @bastelfreak

paebersold commented 6 years ago

Thanks @wyardley