is there a way to make Puppet to differentiate between
my_custom_type { 'key':
value => 'blah',
}
and
my_custom_type { 'key':
value => ['blah'],
}
when declaring resource attributes?
this is for a custom type, so i have full ruby-land control, but both show up to Puppet::Type#set_parameters
and consequently Puppet::Property#should=
as 'blah'
.
i'm using Puppet 3.4.3 on top of Ruby 2.0.0 (through Boxen). i'm not sure how easy it would be for me to change either of those versions.
CONTEXT: the custom type I'm implementing edits Apple property lists (.plist
files), where a string and an array containing a single string element are quite different.
declaring the property like
newproperty(:value, :array_matching => :all) do
along the lines of
https://docs.puppetlabs.com/guides/custom_types.html#customizing-behaviour
doesn't seem to change what set_parameters
or should=
receive, they just make Puppet::Property#should
return ['blah']
instead of 'blah'
in both cases. it appears the differentiation is tossed out further up at the parser level.
providing
my_custom_type { 'key':
value => [['blah']],
}
doesn't help either - same result.
PLEASE NOTE:
i realize i can work around this by providing additional information in the declaration, like so:
my_custom_type { 'key':
value => ['blah'],
is_array => true,
}
or
my_custom_type { 'key':
value_array => ['blah'],
}
i'm wondering if there is a way to capture whether an array or scalar was declared... though feel free to explain to me why doing so would be unwise or heretic in Puppet-world; i'm a little new to this strange place.