On Sep 21, 3:06 pm, rvlinden <rene.vanderlinde...@gmail.com> wrote:
> Hi all,
>
> I have three parameterized classes, named mq, mq_gsk and apache.
> The mq class always calls the mq_gsk class, but the apache class
> should only call the mq_gsk class when the mq class is not used in a
> hosts' node definition
>
> Here is my configuration
>
> class mq (
>   $gsk_version = undef ) {
>
>   require mq::params
>
>   <  ..... >
>
>   class { 'mq_gsk':
>     gsk_version => "${mq::params::package_gsk_version}",
>   }
>
> }
>
> class mq_gsk (
>   $gsk_version = undef ) {
>
>   require mq_gsk::params
>
>   package { $mq_gsk::params::gsk_packages:
>     ensure  => "${mq_gsk::params::package_gsk_version}",
>   }
>
> }
>
> When a node needs to be configured as an MQ server, the mq class will
> be included and mq and the mq gsk software will be installed. However
> some servers only need to have an Apache server installed, but apache
> uses an additional plugin which requires the mq gsk software also.
>
> If I configure a host with either MQ or Apache all is well, but as
> soon as both classes are included in a node, I get a duplicate /
> already defined error (as expected)
>
> ERROR:
> Could not retrieve catalog from remote server: Error 400 on SERVER:
> Duplicate definition: Class[Mq_gsk] is already defined in file /etc/
> puppet/modules/apache/manifests/init.pp at line 104; cannot redefine
> at /etc/puppet/modules/mq/manifests/init.pp:62 on node
> nodex.domainy.com
>
> Within my apache class, I tried to use "if defined()", but this does
> not seem to work at all
>
> Here is one of my many attempts
>
>  if defined(Package["mq_gsk"]) {
>    notice ( "${apache::params::module_name}, mq module defined, mq_gsk
> already included" )
>  } else {
>    notice ( "${apache::params::module_name}, mq module not defined,
> check websphere module defined" )
>    if defined(Package["${apache::params::package_name_module_was}"]) {
>      notice ( "${apache::params::module_name}, websphere module
> defined, mq_gsk included" )
>      class { 'mq_gsk':
>        gsk_version => undef,
>      }
>    }
>  }
>
> I also tried other things which I read on Puppet Users, like
>
> if defined("mq_gsk") {
> if defined("mg_gsk::gsk_version") {
>
> but nothings seems to work. It always says that the mq module is
> defined (while the mq class is not included in the host definition) or
> it says not included (while the mq class is included in the node)
>
> I wonder I 'defined' is to way forward, of if there is a better way to
> solve the 'already defined' issue.
>
> I'm using puppet 2.7.3 on CentOS/RHEL 5.7

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to