i was recently bitten by ordering issues caused by missing contain/anchor declarations in a PostgreSQL module which should have finished its job before configuring and starting the PuppetDB which is done by another module.
So here are my questions:
- is it possible to use the contain function also for defined resource types/defines? I ended up using anchors since i could not find out how to use contain here.
- am i the only one thinking that it is too error-prone and cumbersome to add a contain everytime a sub-class is instantiated in a module? Since it is not transitive it has to be added on every abstraction layer of a module, from the init.pp down to all sub-classes until there are just classes left declaring resources directly. And in case one contain is missing, that code may be executed in the wrong time.
thx,
Peter
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.
Using contain on a defined type is not a syntax error. But you won't provide any of the parameters on the defined type when you use contain. This includes parameter like a unique name. 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. 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.
Secondly, this will still have the same sub-class issue. You can see this here:
https://ask.puppet.com/question/18868/containment-with-role-and-profile-pattern/
Sub-sub-classes in Puppet are not tagged with their ancestor (parent and parent's parent, etc) tags.
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.
Using contain on a defined type is not a syntax error.
But you won't provide any of the parameters on the defined type when you use contain. This includes parameter like a unique name.
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.
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.
hi,i was recently bitten by ordering issues caused by missing contain/anchor declarations in a PostgreSQL module which should have finished its job before configuring and starting the PuppetDB which is done by another module.
So here are my questions:
- is it possible to use the contain function also for defined resource types/defines? I ended up using anchors since i could not find out how to use contain here.
- am i the only one thinking that it is too error-prone and cumbersome to add a contain everytime a sub-class is instantiated in a module? Since it is not transitive it has to be added on every abstraction layer of a module, from the init.pp down to all sub-classes until there are just classes left declaring resources directly. And in case one contain is missing, that code may be executed in the wrong time.