From b8ed6670cd0d77f63b153fb5d5afff41f2c03704 Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Sun, 16 Nov 2008 10:20:22 +1100 Subject: Fixed #1735 and #1747 - Fixes to confine system --- lib/puppet/provider/confine/variable.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/puppet') diff --git a/lib/puppet/provider/confine/variable.rb b/lib/puppet/provider/confine/variable.rb index c868a4e9e..9bef69412 100644 --- a/lib/puppet/provider/confine/variable.rb +++ b/lib/puppet/provider/confine/variable.rb @@ -24,6 +24,11 @@ class Puppet::Provider::Confine::Variable < Puppet::Provider::Confine @facter_value end + def initialize(values) + super + @values = @values.collect { |v| v.to_s.downcase } + end + def message(value) "facter value '%s' for '%s' not in required list '%s'" % [test_value, self.name, values.join(",")] end @@ -35,10 +40,16 @@ class Puppet::Provider::Confine::Variable < Puppet::Provider::Confine def reset # Reset the cache. We want to cache it during a given - # run, but across runs. + # run, but not across runs. @facter_value = nil end + def valid? + @values.include?(test_value.to_s.downcase) + ensure + reset + end + private def setting? -- cgit