Ask Your Question
1

Puppet types with array property

asked 2013-09-06 20:16:38 -0600

dgutierrez1287 gravatar image

I have never seen a concise example of how to make custom types with an array property work, do anyone have a good example of this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2013-09-08 08:35:22 -0600

Stefan gravatar image

At first you should specify :array_matching => :all when defining your property. Otherwise only the first array element is considered as the should value of your property. Another thing you may want to consider is to overwrite the insync? method of your property. The default behaviour is that the current value and the desired value have to be the same. But if in your case the order of in which the elements appear does not matter, you can define your own. e.g.

newproperty(:allowed_hosts, :array_matching => :all) do
  def insync?(is)
    # The current value may be nil and we don't ...
(more)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-09-06 20:16:38 -0600

Seen: 646 times

Last updated: Sep 08 '13