File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 33
33
Facter . add ( "lvm_vg_#{ i } " ) { setcode { vg } }
34
34
Facter . add ( "lvm_vg_#{ vg } _pvs" ) do
35
35
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
+ )
37
40
res = nil
38
41
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 ( ',' )
40
43
end
41
44
res
42
45
end
Original file line number Diff line number Diff line change 63
63
it 'lists vgs' do
64
64
Facter ::Core ::Execution . stubs ( :execute ) # All other calls
65
65
Facter ::Core ::Execution . expects ( :execute ) . at_least ( 1 ) . with ( 'vgs -o name --noheadings 2>/dev/null' , timeout : 30 ) . returns ( "vg0\n vg1" )
66
- Facter ::Core ::Execution . expects ( :execute ) . at_least ( 1 ) . with ( 'vgs -o pv_name vg0 2>/dev/null' , timeout : 30 ) . returns ( " PV \n /dev/pv3\n /dev/pv2" )
67
- Facter ::Core ::Execution . expects ( :execute ) . at_least ( 1 ) . with ( 'vgs -o pv_name vg1 2>/dev/null' , timeout : 30 ) . returns ( " PV \n /dev/pv0" )
66
+ Facter ::Core ::Execution . expects ( :execute ) . at_least ( 1 ) . with ( 'vgs -o pv_name --noheadings vg0 2>/dev/null' , timeout : 30 ) . returns ( " /dev/pv3\n /dev/pv2" )
67
+ Facter ::Core ::Execution . expects ( :execute ) . at_least ( 1 ) . with ( 'vgs -o pv_name --noheadings vg1 2>/dev/null' , timeout : 30 ) . returns ( ' /dev/pv0' )
68
68
Facter . fact ( :lvm_support ) . expects ( :value ) . at_least ( 1 ) . returns ( true )
69
69
Facter . value ( :lvm_vgs ) . should == 2
70
70
Facter . value ( :lvm_vg_0 ) . should == 'vg0'
You can’t perform that action at this time.
0 commit comments