summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-10-16 16:17:30 -0500
committerJames Turnbull <james@lovedthanlost.net>2008-10-17 08:22:59 +1100
commita74ec60d33dee1c592ec858faeccc23d7a7b79f3 (patch)
tree24bbe35f647f2622b42397a52cc66177c59597b8 /lib/puppet
parentd4df36126fa62406c2cbb7a55b18234032da156b (diff)
downloadpuppet-a74ec60d33dee1c592ec858faeccc23d7a7b79f3.tar.gz
puppet-a74ec60d33dee1c592ec858faeccc23d7a7b79f3.tar.xz
puppet-a74ec60d33dee1c592ec858faeccc23d7a7b79f3.zip
Fixing tests I broke when trying to fix the Providers reference.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/provider/confine/variable.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/puppet/provider/confine/variable.rb b/lib/puppet/provider/confine/variable.rb
index 333356341..0ef90d6d8 100644
--- a/lib/puppet/provider/confine/variable.rb
+++ b/lib/puppet/provider/confine/variable.rb
@@ -1,11 +1,19 @@
require 'puppet/provider/confine'
+# Require a specific value for a variable, either a Puppet setting
+# or a Facter value. This class is a bit weird because the name
+# is set explicitly by the ConfineCollection class -- from this class,
+# it's not obvious how the name would ever get set.
class Puppet::Provider::Confine::Variable < Puppet::Provider::Confine
+ # Provide a hash summary of failing confines -- the key of the hash
+ # is the name of the confine, and the value is the missing yet required values.
+ # Only returns failed values, not all required values.
def self.summarize(confines)
result = Hash.new { |hash, key| hash[key] = [] }
- confines.inject(result) { |total, confine| total[confine.class.name] += confine.values unless confine.valid?; total }
+ confines.inject(result) { |total, confine| total[confine.name] += confine.values unless confine.valid?; total }
end
+ # This is set by ConfineCollection.
attr_accessor :name
# Retrieve the value from facter
@@ -20,6 +28,7 @@ class Puppet::Provider::Confine::Variable < Puppet::Provider::Confine
"facter value '%s' for '%s' not in required list '%s'" % [value, self.name, values.join(",")]
end
+ # Compare the passed-in value to the retrieved value.
def pass?(value)
test_value.downcase.to_s == value.to_s.downcase
end