custom type skip array element on munge

49 views
Skip to first unread message

Vasil Mikhalenya

unread,
Nov 1, 2013, 6:32:09 AM11/1/13
to Puppet Users
Hi all,

is there any way to completely ignore some array element when munging

custom_type { "name":
  groups => ["gr1", "gr2", "gr3"],
}

In case of any array member is not exists on system, I want to remove it from resource[:groups]


But this code:

newproperty(:groups, :array_matching => :all) do

munge do |group|

  if does_not_exists(group)

    nil

  else

   group

  end

end


iterates on all array items and returns array with nil items. Is there way to remove items from array in munge.


Thanks.


--
Best regards,
Vasil Mikhalenya
Reply all
Reply to author
Forward
0 new messages