Skip to content

Commit

Permalink
add mdadm fact
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Nov 7, 2013
1 parent 1b1e846 commit 54e6247
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/facter/mdadm.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Facter.add('mdadm') do
confine :kernel => 'Linux'
setcode do
Facter::Util::Resolution.which('mdadm')
end
end
14 changes: 14 additions & 0 deletions spec/unit/facts/mdadm_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 54e6247

Please sign in to comment.