Skip to content

Commit 35cf8a7

Browse files
committed
Don't execute the lvm commands when not supported.
When lvm_support was not present, facter would still attempt to execute the vgs and pvs commands.
1 parent c80e2ae commit 35cf8a7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/facter/lvm_support.rb

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

18-
vgs = Facter::Core::Execution.execute('vgs -o name --noheadings 2>/dev/null', timeout: 30)
18+
if Facter.value(:lvm_support)
19+
vgs = Facter::Core::Execution.execute('vgs -o name --noheadings 2>/dev/null', timeout: 30)
20+
end
1921
if vgs.nil?
2022
setcode { 0 }
2123
else
@@ -46,7 +48,9 @@
4648
Facter.add('lvm_pvs') do
4749
confine :lvm_support => true
4850

49-
pvs = Facter::Core::Execution.execute('pvs -o name --noheadings 2>/dev/null', timeout: 30)
51+
if Facter.value(:lvm_support)
52+
pvs = Facter::Core::Execution.execute('pvs -o name --noheadings 2>/dev/null', timeout: 30)
53+
end
5054
if pvs.nil?
5155
setcode { 0 }
5256
else

0 commit comments

Comments
 (0)