Nan Ah, ok.. Haven't used puppet resource as yet, however think it makes sense to try and support it where possible...
Will see what I can work up with your code :) Cheers Gavin On Friday, 5 April 2013 16:43:08 UTC+1, Nan Liu wrote: > > On Fri, Apr 5, 2013 at 3:33 AM, fatmcgav <[email protected] > <javascript:>>wrote: > >> I was looking at doing all the work in the 'flush' method, however have >> just been doing some more testing and think I've come up with an >> alternative... >> >> Can run the user creation in the 'create' def, and then clear >> @property_hash so that it doesn't get invoked in 'flush'. >> 'Flush' then calls the user modification if required... >> >> Seems to work quite well from my testing :) >> >> Latest code is: >> https://github.com/fatmcgav/fatmcgav-netapp/blob/master/lib/puppet/provider/netapp_user/netapp_user.rb >> > > There's an edge case that will fail for puppet resource, if you don't use > the command then don't worry about this. Puppet resource depends on > @property_hash, so clearing @property_hash after create will result in > incorrect output when a resource is created. Currently I'm using something > similar to this for flush: > > def some_property=(val) > @pending_change = true > @property_hash['some_property'] = val > # queue_change needs to be initialized and it's only necessary if you > need to track what needs to be flushed. > @queue_change['some_property'] = val > end > > def flush > if @pending_change > ... > end > end > > Thanks, > > Nan > -- You received this message because you are subscribed to the Google Groups "Puppet Developers" 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-dev?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
