Nan Cheers again...
Looks like overriding the 'insync?' method is the way to go, as I'm only interested in checking/setting property values that are being passed through... Any insync? examples that I could refer to? Cheers Gavin On 13 November 2012 19:50, Nan Liu <n...@puppetlabs.com> wrote: > On Tue, Nov 13, 2012 at 11:19 AM, Gavin Williams <fatmc...@gmail.com>wrote: > >> After a quick google, came up with: >> >> #!/usr/bin/env ruby >>> >>> grades = { "Bob" => 82, >>> "Jim" => 94, >>> "Billy" => 58 >>> } >>> >>> grades.each do|name,grade| >>> puts "#{name}: #{grade}" >>> end >> >> >> So now all I need to do is pull the existing options values and compile a >> hash to compare in the exists?, and use the above in the create... > > > > Quick question on the create - how will it handle one property that >> matches, but one property that doesn't? >> > > You need a hash diff between current values and desired values and iterate > through the difference. Hash properties are a bit more work, because the > retrieve method may return more options than you care to set. You have the > option to either munge and include default value to the user supplied > value, or override insync? method so the comparison operation does not > invoke option= method if the user specified value is a subset of the return > hash from the option method. > > Alternatively if you only have a short number of options, you can just > implement them as properties instead. > > Thanks, > > Nan > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.