Hi, thanks for your answer.
On Thursday, May 30, 2013 3:13:45 PM UTC+2, jcbollinger wrote:
>
>
> For this particular pattern of requirements, I strongly prefer method 1.
> It keeps everything associated directly with the defined type together in
> one place. I would suggest one tweak, however: the defined type should
> explicitly 'include' class 'software' if it refers to resources declared by
> that class. For example:
>
> define software::mydefinedtype {
> include 'software'
> file { "/path/to/${name}":
> [...]
> require => Package['software'],
> before => Service['software'],
> }
> }
>
Yes, that's what I actually did in the end. And I've also used the include,
as you suggested (I didn't post my whole code in the first post, just the
relevant part).
Note also that if you prefer the chain operators to the metaparameters, you
> can use the former in your defined type:
>
> define software::mydefinedtype {
> include 'software'
> file { "/path/to/${name}":
> [...]
> }
> Package['software'] -> File["/path/to/${name}"] -> Service['software']
> }
>
> Indeed, I think you can even write it like this:
>
> define software::mydefinedtype {
> include 'software'
> Package['software'] ->
> file { "/path/to/${name}":
> [...]
> } ->
> Service['software']
> }
>
>
Clever! Thanks :)
>
>> One doubt about method 2:
>> at http://docs.puppetlabs.com/puppet/3/reference/lang_relationships.html,
>> I can read:
>> "If one of the resources in a relationship is never declared, compilation
>> will fail with one of the following errors [...]"
>> I suppose that this doesn't apply in case of resources chained through
>> resource collectors, does it? I'm asking because, even without declarations
>> of instances of the defined type, I got no such errors.
>>
>>
>
> Personally, I am uncomfortable with relying on undocumented behavior. It
> may change without warning from one version of the software to another.
> Even if that does not bother you, in this particular case you should also
> verify that the transitively implied relationship between
> Package['software'] and Service['software'] is still present when no
> instances of Software::Mydefinedtype are declared. You can make puppet
> generate a relationship graph to check.
>
I avoided the issue too, I'll try to generate the graphs as soon as I have
some spare time.
>
> John
>
Thanks again,
Fabio
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.