diff options
author | William Van Hevelingen <blkperl@cat.pdx.edu> | 2014-01-16 22:22:38 -0800 |
---|---|---|
committer | William Van Hevelingen <blkperl@cat.pdx.edu> | 2014-01-22 22:54:34 -0800 |
commit | fe676f0ac4e1d96e77ba7fe894408d8e7647eacc (patch) | |
tree | 49540bcda1fc5b7dc91c9920ba147200047679fa /spec/unit/facter | |
parent | e49d356fbf84798ebf7dbd5682de18c368b0ccec (diff) | |
download | puppet-stdlib-fe676f0ac4e1d96e77ba7fe894408d8e7647eacc.tar.gz puppet-stdlib-fe676f0ac4e1d96e77ba7fe894408d8e7647eacc.tar.bz2 |
(PUP-1459) Add support for root_home on OS X 10.9
getent does not exist on 10.9 so this commit uses
dscacheutil to query the homedir for the root user.
Diffstat (limited to 'spec/unit/facter')
-rw-r--r-- | spec/unit/facter/root_home_spec.rb | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/spec/unit/facter/root_home_spec.rb b/spec/unit/facter/root_home_spec.rb index ce80684..532fae1 100644 --- a/spec/unit/facter/root_home_spec.rb +++ b/spec/unit/facter/root_home_spec.rb @@ -20,15 +20,6 @@ describe Facter::Util::RootHome do Facter::Util::RootHome.get_root_home.should == expected_root_home end end - context "macosx" do - let(:root_ent) { "root:*:0:0:System Administrator:/var/root:/bin/sh" } - let(:expected_root_home) { "/var/root" } - - it "should return /var/root" do - Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(root_ent) - Facter::Util::RootHome.get_root_home.should == expected_root_home - end - end context "windows" do before :each do Facter::Util::Resolution.expects(:exec).with("getent passwd root").returns(nil) @@ -38,3 +29,23 @@ describe Facter::Util::RootHome do end end end + +describe 'root_home', :type => :fact do + before { Facter.clear } + after { Facter.clear } + + context "macosx" do + before do + Facter.fact(:kernel).stubs(:value).returns("Darwin") + Facter.fact(:osfamily).stubs(:value).returns("Darwin") + end + let(:expected_root_home) { "/var/root" } + sample_dscacheutil = File.read(fixtures('dscacheutil','root')) + + it "should return /var/root" do + Facter::Util::Resolution.stubs(:exec).with("dscacheutil -q user -a name root").returns(sample_dscacheutil) + Facter.fact(:root_home).value.should == expected_root_home + end + end + +end |