On Mon, Oct 22, 2012 at 10:53:44PM +0200, Jakov Sosic wrote: > On 10/21/2012 10:43 PM, Nan Liu wrote: > > > Puppet::Type.newtype(:customtype) do > > newproperty(:myarray, array_matching => :all) do > > end > > end > > Thank you! > > Although you have syntax error, it should be: > > newproperty(:myarray, :array_matching => :all) do > > Note the collon in front of array_matching. > > > Also, what I did notice is that this code: > > newproperty(:nameservers, :array_matching => :all) do > desc "list of nameservers" > defaultto [] > end > > Doesn't revert to default if I remove the 'nameservers' property from my > manifest. > > I had to overload insync? for it to work, and now type looks like this: > > newproperty(:nameservers, :array_matching => :all) do > desc "list of nameservers added to profile" > defaultto [] > def insync?(is) > # if members of arrays are not the same, something > # was added or removed from manifest, so return false > return false unless is == should > true > end > end > > > Although I don't get it because I didn't do anything special in the > overloaded insync? :) And without it won't work. It won't work even if I > set: > > nameservers => [] > > in my manifest. > > But never mind, I got it working so I'm satisfied so far.
Yeah I also consider this a bug. There is a ticket for the issue though http://projects.puppetlabs.com/issues/10237 -Stefan -- 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.