On Thu, Jan 6, 2011 at 14:19, R.I.Pienaar <[email protected]> wrote:
>> On Thu, Jan 6, 2011 at 12:29, Luc Suryo <[email protected]> wrote:
>>
>> > Is it possible to define a class say php-fpm that requires the class
>> > php to be called first? if so what s the syntax?
>>
>> Yes: package { "foo": require => Class["bar"] }
>>
>> I think Nigel just pointed out in another thread that this is, in
>> fact, our recommended way to do cross-module and cross-class
>> dependencies. I certainly do, because it means you can change the
>> implementation of the PHP stuff without peturbing the php-fpm module
>> at all.
>
> I dont get it,
>
> if you have a number of inter dependent classes that you got somewhere,
> lets say the puppet forge, you'd want that class to have its own dependencies
> and requires between classes and such.
>
> You would then use the class syntax as above to supply parameters to configure
> these classes but you would really not want to use it to set relationships
> between classes.  You should not need to know that php::foo is designed to run
> after php::install and php::configure, thats an implementation detail not a 
> use
> case detail.

Well, to address that the 'include php::install' mechanism also
serves, but you are right that ...

> So if you're recommending this as The Way then we'll end up with a bunch
> of classes downloaded from github and such with either no relationship
> or lacking the ability to pass in arguments for the class.

...it doesn't play nicely with parameterized classes at this point in time.

[...]

> In this example that you are responding to - class php::foo that requires php 
> -
> your suggestion is a bit weird.  With your suggestion anyone who ever want to
> use this class need to know "when including php::foo you need to remember to
> set the requirement on foo" when in fact what you want is to include the 
> foo::bar
> class and it should just behave in a sane way without any burden of 
> documentation
> or everyone using it creating the dependencies tree.

I was perhaps too terse in my response here: generally I would expect
that to happen *inside* the php::foo class, so that 'include php::foo'
would do the right thing on the node:

    class foo { ... }
    class bar {
        include foo
        package { "whatever": require => Class["foo"] }
    }

Then 'include bar' will just work™ for end users, including the
appropriate cross-class dependencies and inclusions.  Which still
fails if foo is parameterized, but that is ... a rough area right now.
:)

Regards,
    Daniel
-- 
✉ Daniel Pittman <[email protected]>
⌨ [email protected] (XMPP)
☎ +1 503 893 2285
♻ made with 100 percent post-consumer electrons

-- 
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