forked from jhoblitt/puppet-smartd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fact for the path to the smartd executable.
- Loading branch information
Joshua Hoblitt
committed
Apr 11, 2014
1 parent
0950ccb
commit 8cbfc2b
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Facter.add(:smartd) do | ||
confine :kernel => :linux | ||
|
||
setcode do | ||
Facter::Util::Resolution.which('smartd') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'spec_helper' | ||
|
||
describe 'smartd', :type => :fact do | ||
before(:each) { Facter.clear } | ||
|
||
context 'on linux' do | ||
context 'not in path' do | ||
it do | ||
Facter.fact(:kernel).stubs(:value).returns('Linux') | ||
Facter::Util::Resolution.stubs(:which).with('smartd').returns(nil) | ||
Facter.fact(:smartd).value.should be_nil | ||
end | ||
end | ||
|
||
context 'in path' do | ||
it do | ||
Facter.fact(:kernel).stubs(:value).returns('Linux') | ||
Facter::Util::Resolution.stubs(:which).with('smartd').returns('/usr/sbin/smartd') | ||
Facter.fact(:smartd).value.should == '/usr/sbin/smartd' | ||
end | ||
end | ||
end | ||
|
||
end | ||
|