Hi,

First, thanks for your help. However I still have some issues with your
solution.

jcbollinger <[email protected]> writes:

> few bad ones.  Here's a good rule of thumb: never use Puppet's
> "defined()" function in your manifests.  Ever.  It is brittle, and it
> will cause you grief, increasing exponentially with the number of
> uses.
.../...
> There is no need for subclassing or defined() here.  I would approach
> the problem something like this:


>   # Resource defaults for Packages in this class
>   Package {
>     ensure => installed,
>     require => Package['php'],
>     notify => Service['httpd']
>   }

This creates a dependency loop:

err: Could not apply complete catalog: Found dependency cycles in the following 
relationships: Package[php] => Package[httpd], Package[httpd] => Package[php], 
Package[php] => Package[php-ldap], Package[php-imap] => Package[php-mysql], 
Package[php-gd] => Package[php-mysql], Package[php-ldap] => Package[php-mysql], 
Package[php] => Package[php-mysql], Package[httpd] => 
File[/etc/httpd/conf.d/mod-status.conf], Package[php] => Package[php-mbstring], 
Package[httpd] => Service[httpd], Package[httpd] => Service[httpd], 
Package[php-imap] => Service[httpd], Package[php-mysql] => Service[httpd], 
Package[php-gd] => Service[httpd], Package[php-ldap] => Service[httpd], 
Package[php] => Service[httpd], File[/etc/httpd/conf.d/mod-status.conf] => 
Service[httpd], Package[php-mbstring] => Service[httpd], Package[php] => 
Package[php-imap], Package[php] => Package[php-gd], Package[httpd] => 
File[/var/www/html]; try using the '--graph' option and open the '.dot' files 
in OmniGraffle or GraphViz

As far as I understand, Package['httpd'] (defined in class apache::base)
inherits the dependency on Package['php']. This is using Puppet 2.6.8;
has this changed in 2.7.x?

> # ** No class apache::php53 **

So how do I tell Puppet which nodes need 5.1 and which need 5.3? With my
sample wordpress class I get the following error:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could 
not find class apache::php53 in namespaces wordpress at 
/etc/puppet/modules/wordpress/manifests/init.pp:6 on node testxen1.ircam.fr

Looks like using a dummy class definition as a flag won't work. :-) I
could use a variable instead, but I guess the ordering issues would get
even worse?

> # class apache::params unchanged, not shown

So I'm still using defined().

> As my manifest shows, I'm not sure "yum replace" is really needed.  If
> it is needed after all, then it shouldn't be too hard to adjust the
> above to use it.

Actually your solution looks much cleaner than "yum replace".

-- 
Arnaud

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

Reply via email to