On Apr 16, 11:55 am, flzz <[email protected]> wrote:
> Greetings,  I'm doing some experimentation with stages and can't quite
> figure out how to leverage stages when calling a defined type from
> within a node definition.  For example if I have a class defined
>
> class hosts {
>   define entry ($val) {
>     # set some stuff in etc hosts
>     }
>
> }
>
> node mynode {
>   class { "hosts": stage = os }
>
>   hosts::entry {
>     val => "foo"
>   }
>
> }
>
> The only way to scope hosts::entry into the os stage (that I know of)
> is to create a wrapper class which includes the class which I want to
> scope in and calls the defined type.  Then adding the wrapper class to
> the stage I want.  Any other way to do this?

Type definitions do not need to go inside classes; indeed, the
recently-updated style guide recommends that they go in their own
files.  You can therefore get rid of the class enclosing the
definition.  You still need to put the instantiations of your defined
type into a class, however, because only classes can be directly
assigned to run stages.  That's not altogether a bad thing, however,
because it's generally better practice to avoid declaring resources
directly at node level.

If you want to be able to assign individual resources to run stages
(not unreasonable, but also not a clear win) then you should file a
ticket for it.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to