Skip to content

Commit 0a650a1

Browse files
authored
Merge pull request #2701 from mhashizume/maint/main/revert-confine
Revert "Merge pull request #2699 from mhashizume/FACT-3156/main/confi…
2 parents 06fa306 + eedccc7 commit 0a650a1

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

lib/facter/custom_facts/util/confine.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def to_s
3535
end
3636

3737
# Evaluate the fact, returning true or false.
38-
# if we have a block parameter then we only evaluate that instead
38+
# if we have a block paramter then we only evaluate that instead
3939
def true?
4040
if @block && !@fact
4141
begin
@@ -54,11 +54,9 @@ def true?
5454

5555
return false if value.nil?
5656

57-
# We call the block with both the downcased and raw fact value for
58-
# backwards-compatibility.
5957
if @block
6058
begin
61-
return !@block.call(value).nil? || !@block.call(fact.value).nil?
59+
return !!@block.call(value)
6260
rescue StandardError => e
6361
log.debug "Confine raised #{e.class} #{e}"
6462
return false

spec/custom_facts/util/confine_spec.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,6 @@ def confined(fact_value, *confines)
126126
expect(confine.true?).to be true
127127
end
128128

129-
it 'accepts and evaluate a block argument against the fact while respecting case' do
130-
allow(fact).to receive(:value).and_return 'Foo'
131-
confine = LegacyFacter::Util::Confine.new(:yay) { |f| f == 'Foo' }
132-
expect(confine.true?).to be true
133-
end
134-
135129
it 'returns false if the block raises a StandardError when checking a fact' do
136130
allow(fact).to receive(:value).and_return 'foo'
137131
confine = LegacyFacter::Util::Confine.new(:yay) { |_f| raise StandardError }

0 commit comments

Comments
 (0)