So I've run into a bit of a problem that has bitten many others in the 
past: I'm using module A and module B which both require package C, and I'm 
ending up with a duplicated resource definition for the mod_ssl package.  
In my case, the modules are puppet-rvm <https://github.com/blt04/puppet-rvm>and 
puppetlabs-apache <https://github.com/puppetlabs/puppetlabs-apache> which 
both require *mod_ssl*.

The problem stems from here:

in puppet-rvm:

puppet-rvm/manifests/passenger/apache/centos/pre.pp<https://github.com/blt04/puppet-rvm/blob/master/manifests/passenger/apache/centos/pre.pp>

class rvm::passenger::apache::centos::pre {
  # Dependencies
  if ! defined(Package['httpd'])       { package { 'httpd':       ensure => 
present } }
  if ! defined(Package['httpd-devel']) { package { 'httpd-devel': ensure => 
present } }
*  if ! defined(Package['mod_ssl'])     { package { 'mod_ssl':     ensure => 
present } }*
}


and in puppetlabs-apache:

puppetlabs-apache/manifests/params.pp:63<https://github.com/puppetlabs/puppetlabs-apache/blob/master/manifests/params.pp>

$mod_packages = { 
  'proxy_html' => 'mod_proxy_html', 
  'python' => 'mod_python',
  'shibboleth' => 'shibboleth',
*  'ssl' => 'mod_ssl', *
  'wsgi' => 'mod_wsgi',
  'dav_svn' => 'mod_dav_svn', 
   'xsendfile' => 'mod_xsendfile', 
}

puppetlabs-apache/modules/apache/manifests/mod.pp:35<https://github.com/puppetlabs/puppetlabs-apache/blob/master/manifests/mod.pp>

package { $mod_packages: ensure => present, 
     require => Package['httpd'], 
      before => File["${mod_dir}/${mod}.load"], 
}

So the rvm module attempts to resolve a conflict by using "*! 
defined(Package['mod_ssl'})*", while the apache module just defines an 
array of packages and then requires them all.  This causes a failure if the 
apache module is included after the rvm module, since the apache module 
doesn't check to see if any of the packages are already defined.

It seems there are a few ways to remedy this, such as defining a new class 
for the mod_ssl 
package<https://groups.google.com/d/msg/puppet-users/julAujaVsVk/EQAk3HrpwAIJ>and
 including that class in both modules.  However, I'd like to figure out 
if it's possible to rectify this situation without modifying either 
module.  I've tried in vain to use many different permutations of require 
and -> for resource ordering to ensure that the puppetlabs-apache module 
gets loaded first, but I just can't manage to get it to work. it seems no 
matter what I do, the rvm module is loaded first, which causes the 
puppetlabs-apache module to fail.

So can anyone tell me how I can get around this problem? I'd very much like 
to modify the puppetlabs-apache module, but since they use an array to 
define the required mod packages, it makes it a little tricky to check if 
each one is defined before using it, since as far as I know it's not very 
straight forward to iterate over an array in the puppet DSL.  Thanks for 
any suggestions!

Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to