On Thursday, February 15, 2018 at 9:09:34 PM UTC-6, Jeremiah Powell wrote:
>
> You can also use stages to define strong barriers to order large parts of 
> a task.  The canonical example is configuring a database before the 
> application that needs it.
>

Stages are the wrong tool for almost every task, and especially for 
containment problems.  Stages best serve cases where you can formulate 
*universal*, generic rules, such as "Package repositories must be installed 
and configured before anything (else) that requires managing packages," but 
which you cannot easily implement those in terms of specific relationships 
or collector-based chaining rules.
 

>
> Using contain on a defined type is not a syntax error.
>


Do you mean "using contain *in* a defined type is not a syntax error"?  
Maybe it's not, but the semantics of such usage will be troublesome at 
best.  But no, contain is not meant for use declaring resource instances, 
whether of defined or plugin types.  It is not useful for that purpose, 
because resources are *automatically* contained by whatever class or 
resource declares them.  The containment question arises only for classes, 
which, by design, are not automatically contained.

 

>   But you won't provide any of the parameters on the defined type when you 
> use contain.  This includes parameter like a unique name.
>
 

If (pointlessly) declaring a resource via the contain function in fact 
works at all, then that resource instance must get some default name, such 
as an empty one.  That would mean that such a contain could only be 
evaluated once, lest an attempt to declare a duplicate resource occur.


  So the semantic meaning is rather curious. It adds a tag to the define 
> type with the name of the class then adds a dependency between instances of 
> the defined type and the class.  All of the defined type instances.
>


I don't know what you're talking about.  Puppet does perform automatic 
tagging of classes and resources, including tagging each resource with the 
name of the class that declared it, and tags are passed along via 
containment, but this has nothing to do with the contain function in 
particular.

 

> That won't help you, though, for two reasons.  First, depending on the 
> version of Puppet the resources in the defined type won't get the 
> relationship.
>
> Look at the graph for your node.
>
> You should see the resources in your sub-classes 'floating' off the 
> graph.  They should have no relationship to anything else.
>


I think you're confused.  *Classes* may float off the containment graph, 
but *resources* can do so only if they are declared at top scope in the 
first place, because they are automatically contained by their declaring 
object -- node, class, or other resource -- as already discussed.

And at this point I'm stopping.


John

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/84446913-6518-4f0e-bc0b-bd9af26eea17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to