diff options
author | Nigel Kersten <nigelk@google.com> | 2009-09-30 11:57:41 -0700 |
---|---|---|
committer | Nigel Kersten <nigelk@google.com> | 2009-09-30 11:57:41 -0700 |
commit | ad86e9e7b6c67280fb5b687211d15f3df103b0e0 (patch) | |
tree | 95702fa96121fb91bcdabb67b06758678c36691c /lib/puppet | |
parent | d891f7acd190637ea7adc19d51f1961e2021e835 (diff) | |
download | puppet-ad86e9e7b6c67280fb5b687211d15f3df103b0e0.tar.gz puppet-ad86e9e7b6c67280fb5b687211d15f3df103b0e0.tar.xz puppet-ad86e9e7b6c67280fb5b687211d15f3df103b0e0.zip |
Fixes #2688. Macauthorization provider now handles booleans internally correctly.
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/provider/macauthorization/macauthorization.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/puppet/provider/macauthorization/macauthorization.rb b/lib/puppet/provider/macauthorization/macauthorization.rb index b53529cb4..d1e2b229f 100644 --- a/lib/puppet/provider/macauthorization/macauthorization.rb +++ b/lib/puppet/provider/macauthorization/macauthorization.rb @@ -226,11 +226,18 @@ Puppet::Type.type(:macauthorization).provide :macauthorization, :parent => Puppe # This mainly converts the keys from the puppet attributes to the # 'native' ones, but also enforces that the keys are all Strings # rather than Symbols so that any merges of the resultant Hash are - # sane. + # sane. The exception is booleans, where we coerce to a proper bool + # if they come in as a symbol. newplist = {} propertylist.each_pair do |key, value| next if key == :ensure # not part of the auth db schema. next if key == :auth_type # not part of the auth db schema. + case value + when true, :true + value = true + when false, :false + value = false + end new_key = key if PuppetToNativeAttributeMap.has_key?(key) new_key = PuppetToNativeAttributeMap[key].to_s @@ -243,7 +250,7 @@ Puppet::Type.type(:macauthorization).provide :macauthorization, :parent => Puppe end def retrieve_value(resource_name, attribute) - + # We set boolean values to symbols when retrieving values if not self.class.parsed_auth_db.has_key?(resource_name) raise Puppet::Error.new("Cannot find #{resource_name} in auth db") end @@ -257,9 +264,9 @@ Puppet::Type.type(:macauthorization).provide :macauthorization, :parent => Puppe if self.class.parsed_auth_db[resource_name].has_key?(native_attribute) value = self.class.parsed_auth_db[resource_name][native_attribute] case value - when true, "true", :true + when true, :true value = :true - when false, "false", :false + when false, :false value = :false end @@ -287,14 +294,7 @@ Puppet::Type.type(:macauthorization).provide :macauthorization, :parent => Puppe end define_method(field.to_s + "=") do |value| - case value - when true, "true", :true - @property_hash[field] = :true - when false, "false", :false - @property_hash[field] = :false - else - @property_hash[field] = value - end + @property_hash[field] = value end end |