empty value for provider setter
I implemented a pair of type and provider for a new resource. I defined a series of new parameters for a provider, and it looks like this.
... newparam(:name) do desc "description blah" end newproperty(:foo) do desc "foo property. This should be able to take empty value" end ...
and in the provider, I wrote getter and setter for property
... def foo @property_hash[:foo] end def foo=(value) # call cmd binary to set property set_property(value) end ...
This resource works well when it the foo has a value, but if the value is not set, it triggers an error message.
# puppet resource my_property foo="bar" // works well # puppet resource my_property foo="" // error Error: Could not run: Invalid parameter setting foo=
foo="" is meant to be "property reset", and I wonder there is any way I can allow empty string for a property.
This is by design of the command binary I'm utilizing so I need to pass down empty string somehow.
In type, I tried
munge to get
@resource.original_parameters[:foo] value and override it, but puppet even doesn't go inside the
munge do block without parameter value.