On Sunday, May 10, 2015 at 8:03:25 AM UTC-5, Martin Alfke wrote:
>
> Hi, 
>
> I am working on some types and providers for opennebula network 
> management. 
>
> I have one type already finished, which creates the network itself. 
> Each network can have multiple address ranges. 
>
> My idea so far: 
>
> onevnet { ’testnet’: 
>   ensure => present, 
>   … 
> } 
>
> onevnet_addressrange { ‘<name>’: 
>   ensure  => present, 
>   onevnet => ‘testnet’, 
>   … 
> } 
>
> How can I enforce that onevent ‘testnet’ has to be declared? 
> I found auto require but that seems to be optional (or did I miss 
> something). 
>


Autorequire is about order-of-application dependencies between resources 
under Puppet management.  It is not about which resources *should be* under 
management in the first place.  For example, autorequire automatically 
causes a File's parent directory to be managed before the File itself, 
provided that the parent is under management.

You should consider structuring your type so that instances do not 
inherently depend on another resource being declared.  A hard dependency 
such as that is a good sign that your resource is not properly scoped.

If for some reason you must have a hard dependency, then the easiest route 
to take might be to specify that the plugin type is for your module's 
internal use only (though you cannot enforce that), and provide a defined 
type wrapper for public use.  The wrapper can declare a fixed, 
unconditional relationship with whatever other resources you like, and 
catalog building will fail if any of those resources is not declared.


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/d0ce5ac8-100a-42ed-90d5-ee5286c7aa7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to