On Saturday, April 6, 2013 5:22:03 PM UTC-5, Stefan Schulte wrote:
>
> On Fri, 5 Apr 2013 00:57:32 -0700 (PDT) 
> Gavin Williams <fatm...@gmail.com <javascript:>> wrote: 
>
> > Morning all 
> > 
> > I'm working on converting some of my NetApp providers to 
> > prefetch/flush style to try and optimize performance. 
> > 
> > I've hit an issue on my Netapp_user provider, around handling 
> > resource creation versus resource modification? 
> > What's the easiest way to differentiate? 
> > 
> > Current code is here: 
> > 
> https://github.com/fatmcgav/fatmcgav-netapp/commit/66092978f4182c5474a60011db99ee2e3e12e689
>  
> > 
> > Any tips appreciated. 
> > 
> > Regards 
> > Gavin 
> > 
>
> There is no way to check *why* the flush method was called, you just now 
> that at least one property has been updated. You do not see if `ensure` 
> updated or let's say `passmaxage`. Does this actually cause problems? 
>


Your prefetch() method determines which target resources already exist as 
part of its normal job.  It could flag those resources via some internal 
variable of the resource, or perhaps even in the @property_hash.  You could 
even formalize that by creating a read-only property for it, if that makes 
you more comfortable.  At flush() time you can assume that resources that 
are flagged already exist, and those that are not, don't.  There is a small 
window for collision if physical resources of the target type can be 
created / destroyed by a different process while Puppet is running, but 
that issue exists in any case.

If you were not doing prefetching then the provider could check the 
existence of the physical resource as the first step of flushing.  Indeed, 
it would need to do so, one way or another, to correctly apply the 
resource's 'ensure' parameter.  Your provider can work this way despite 
prefetching if you don't want to mark prefetched resources. 


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 post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to