I am writing a Puppet provider and I need a boolean property. I declared it with:
newproperty(:no_sync, :boolean => true) do
desc "Whether to omit syncing the file after every logging, ony when action_type is file."
end
Then I need to declare the no_sync function in the provider which should return true or false. However, when I do this, it seems the values returned as not properly interpreted by Puppet. I’ve tried returning strings (:true and :false respectively), but as a result they always get interpreted as true (which is quite logical).
How are we supposed to declare boolean properties in a Puppet provider?
Returning the symbols
:trueand:falsefrom the provider method is the correct thing to do.You could take a look at the macauthorization source code for an example of how the type is defined. The provider for this type returns
:trueor:false.