Skip to content

Commit f175796

Browse files
committed
lvm_support: update fact to use no headings
I noticed upgrading that the `lvm_vg_#{vg}_pv` facts dose not use the `--no-headings` switch like the other facts. This PR adds the `--no-headings` switch and simplifies the collection
1 parent cada6d4 commit f175796

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/facter/lvm_support.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@
3333
Facter.add("lvm_vg_#{i}") { setcode { vg } }
3434
Facter.add("lvm_vg_#{vg}_pvs") do
3535
setcode do
36-
pvs = Facter::Core::Execution.execute("vgs -o pv_name #{vg} 2>/dev/null", timeout: 30)
36+
pvs = Facter::Core::Execution.execute(
37+
"vgs -o pv_name --noheadings #{vg} 2>/dev/null",
38+
timeout: 30
39+
)
3740
res = nil
3841
unless pvs.nil?
39-
res = pvs.split("\n").select { |l| l =~ %r{^\s+/} }.map(&:strip).sort.join(',')
42+
res = pvs.split("\n").map(&:strip).sort.join(',')
4043
end
4144
res
4245
end

0 commit comments

Comments
 (0)