On Tue, Dec 1, 2015 at 7:48 AM Peter Berghold <salty.cowd...@gmail.com>
wrote:

> Given the following pattern in a puppet manifest:
>
> file{ 'some/file/foo':
>       content => 'blah blah blah',
>       notify => Exec['talkaboutfoo']
> }
> exec { 'talkaboutfoo':
>      cmd => "some/command/some/where",
>      subscribe => File['some/file/foo']
> }
>
> with a little bit of hand waving.
>
> Is there something similar in a custom provider?  Reason I'm asking is I
> have
> written a custom provider for a very customized piece of locally grown
> software that ideally one of the configuration parameters
>
> mytype{ 'instance':
>      state => "on",          # this parameter
>      parm1=> "a",
>      parm2=> "b",
>      parm3=>"c"
> }
>
> should be set *last* among all the other parameters.
>
> Is there a way to do that?
>
>
Hi Peter,

You can do this by implementing a `flush` method on your provider. The
typical pattern is that each individual property setter just stores the
value into an instance variable that is a hash of property_name=>value
pairs (normally called @property_hash), and then `flush` does all the work
of actually writing those values. This will allow you to order the actual
interactions with the real world however you need.


Gary Larizza's blog has some great posts on Provider development -
http://garylarizza.com/blog/2013/12/15/seriously-what-is-this-provider-doing/
contains the information on @property_hash, but if you're new to writing
types and providers I'd recommend reading the first two (linked from that
one) as well to make sure you have all the context.


Branan Riley
Software Engineer, Puppet Labs

-- 
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/CADWDnr%3D4ifafTrM26YVNWTdU9DVsXNz4HmdXS4Z%3DYn83Ec1qoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to