Le 27/08/2013 22:49, jcbollinger a écrit :
 
> Your modules are not independent in any case.  The data dependency is a 
> symptom, not the root issue.

Yes, you are right.

> To answer more generally, since you started by posing a rather general 
> problem, where you have a bona fide configuration dependency, it is not 
> wrong for one module to depend on another.  Real systems are composed of 
> multiple interdependent pieces, so it is natural for your models of them to 
> contain dependencies.  You can shift them around to various places and 
> forms, but you cannot omit them and still have anything of much use.

Ok, I understand, impossible to escape real dependencies, that's life.

> One place you did not mention, to which you could shift the dependency 
> modeling, is your data.  For example, lift your 'community' key to the top 
> level of your YAML data, consolidating all copies of it.  Then have any 
> class that needs that particular key just load it.

Very good idea. In fact, I saw the things with an oriented object approach: a
class must know its data.

> I don't think there is a clear, universal right answer here.  My best 
> advice is to find where each datum belongs, and put it there.  Coincidental 
> data duplication should not concern you overmuch, but do avoid duplicating 
> data for the purpose of presenting a false semblance of independence.

Ok, I keep theses advices in my mind:
- no duplication of data
- define clearly where each datum belongs and put it there.

I think it's a good idea to border the dependency on the data and not in
the puppet code.

I thought about another way with the extlookup function.

---
snmp:
 community: extvalue_community

monitoring:
 community: extvalue_community

And in a common.csv file:

extvalue_community,abcd1234

Then:

class snmp {

    $snmp      = hiera_hash('snmp')
    $community = extlookup($snmp['community'])
    
    # and the rest of the class...

}
class monitoring {

    $monitoring = hiera_hash('monitoring')
    $community  = extlookup($monitoring['community'])

    # and the rest of the class...

}

I don't know if it's good method. 

Thanks for your help John.

--
Francois Lafont

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to