Skip to content

Commit 3d2e143

Browse files
author
tphoney
committed
Adding the 30 second timeout for facts/test fix
1 parent 41a7129 commit 3d2e143

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

lib/facter/lvm_support.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
Facter.add('lvm_vgs') do
1616
confine :lvm_support => true
1717

18-
lvm = Facter.value(:lvm_support)
19-
if lvm
20-
vgs = Facter::Core::Execution.execute('vgs -o name --noheadings 2>/dev/null', timeout: 30)
21-
end
18+
vgs = Facter::Core::Execution.execute('vgs -o name --noheadings 2>/dev/null', timeout: 30)
2219
if vgs.nil?
2320
setcode { 0 }
2421
else
@@ -49,10 +46,7 @@
4946
Facter.add('lvm_pvs') do
5047
confine :lvm_support => true
5148

52-
lvm = Facter.value(:lvm_support)
53-
if lvm
54-
pvs = Facter::Core::Execution.execute('pvs -o name --noheadings 2>/dev/null', timeout: 30)
55-
end
49+
pvs = Facter::Core::Execution.execute('pvs -o name --noheadings 2>/dev/null', timeout: 30)
5650
if pvs.nil?
5751
setcode { 0 }
5852
else

spec/unit/facter/lvm_support_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@
5252
context 'when there is lvm support' do
5353
context 'when there are no vgs' do
5454
it 'should be set to 0' do
55-
Facter.fact(:lvm_support).expects(:value).at_least(1).returns(true)
5655
Facter::Core::Execution.stubs(:execute) # All other calls
5756
Facter::Core::Execution.expects(:execute).at_least(1).with('vgs -o name --noheadings 2>/dev/null', timeout: 30).returns(nil)
57+
Facter.fact(:lvm_support).expects(:value).at_least(1).returns(true)
5858
Facter.value(:lvm_vgs).should == 0
5959
end
6060
end

0 commit comments

Comments
 (0)