On 6/30/2010 5:07 PM, Patrick Mohr wrote:
By the way, ignoring the technical aspect, how do you think defined
should work in this case? In this case, what aleart should be printed,
or what error should be printed? This is a rather contrived example, but
I'm not really sure what puppet should actually do here with your
suggestion. (Please excuse my syntax errors).



node 'test-node' {
        include classA
        include classB
}


class classA {
        if !defined Package['apache']
        {
                package { 'apache':
                        ensure =>  installed,
                }

                alert("Package apache included by classA")
        }
}

class classB {
        if !defined Package['apache']
        {
                package { 'apache':
                        ensure =>  installed,
                }

                alert("Package apache included by classB")
        }
}

In an ideal world, this is an invalid manifest. Especially when you add more resources in there, that have different properties in classA vs classB. The correct way to implement that would be to extract the conditional resources into a common class.



Best Regards, David
--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

       FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-us...@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