On Fri, 5 Apr 2013 00:57:32 -0700 (PDT) Gavin Williams <[email protected]> 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? One thing I've spotted is that your create method does update the @property_hash[:ensure] value but no other value. This seems to be wrong because if the resource was absent before, @property_hash is initally an empty hash. Because when `ensure` changes no other properties are synced you don't have the desired values of all the other properties available in the `flush` method. So your `create` method should propably look like def create resource.class.validproperties.each do |property| if value = resource.should(property) @property_hash[property] = value end end end -Stefan -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
