diff --git a/lib/facter/mdadm.rb b/lib/facter/mdadm.rb new file mode 100644 index 0000000..0c8388f --- /dev/null +++ b/lib/facter/mdadm.rb @@ -0,0 +1,6 @@ +Facter.add('mdadm') do + confine :kernel => 'Linux' + setcode do + Facter::Util::Resolution.which('mdadm') + end +end diff --git a/spec/unit/facts/mdadm_spec.rb b/spec/unit/facts/mdadm_spec.rb new file mode 100644 index 0000000..8e278b3 --- /dev/null +++ b/spec/unit/facts/mdadm_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +describe 'mdadm', :type => :fact do + before(:each) { Facter.clear } + + context 'kernel => Linux' do + it 'should find the executable' do + Facter.fact(:kernel).stubs(:value).returns('Linux') + Facter::Util::Resolution.stubs(:which).with('mdadm').returns('/sbin/mdadm') + + Facter.fact(:mdadm).value.should == '/sbin/mdadm' + end + end +end