raphink
raphink

Reputation: 3665

Boolean property in Puppet provider

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?

Upvotes: 0

Views: 824

Answers (1)

Jeff McCune
Jeff McCune

Reputation: 371

Returning the symbols :true and :false from 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 :true or :false.

Upvotes: 2

Related Questions