Skip to content

Commit d2864e8

Browse files
authored
Merge pull request #222 from jonny0303/jonny0303-patch-1
Don't execute the lvm commands when not supported. #193
2 parents 0537002 + 9dbfc1c commit d2864e8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/facter/lvm_support.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
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)
19-
18+
if Facter.value(:lvm_support)
19+
vgs = Facter::Core::Execution.execute('vgs -o name --noheadings 2>/dev/null', timeout: 30)
20+
end
21+
2022
if vgs.nil?
2123
setcode { 0 }
2224
else
@@ -46,8 +48,9 @@
4648
pv_list = []
4749
Facter.add('lvm_pvs') do
4850
confine :lvm_support => true
49-
50-
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
5154

5255
if pvs.nil?
5356
setcode { 0 }

0 commit comments

Comments
 (0)