File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ class << self
77 def get_root_home
88 root_ent = Facter ::Util ::Resolution . exec ( "getent passwd root" )
99 # The home directory is the sixth element in the passwd entry
10- root_ent . split ( ":" ) [ 5 ]
10+ # If the platform doesn't have getent, root_ent will be nil and we should
11+ # return it straight away.
12+ root_ent && root_ent . split ( ":" ) [ 5 ]
1113 end
1214 end
1315end
Original file line number Diff line number Diff line change 3030 end
3131 end
3232 context "windows" do
33- let ( :root_ent ) { "FIXME TBD on Windows" }
34- let ( :expected_root_home ) { "FIXME TBD on Windows" }
35-
36- it "should return FIXME TBD on windows" do
37- pending "FIXME: TBD on windows"
38- Facter ::Util ::Resolution . expects ( :exec ) . with ( "getent passwd root" ) . returns ( root_ent )
39- Facter ::Util ::RootHome . get_root_home . should == expected_root_home
33+ before :each do
34+ Facter ::Util ::Resolution . expects ( :exec ) . with ( "getent passwd root" ) . returns ( nil )
35+ end
36+ it "should be nil on windows" do
37+ Facter ::Util ::RootHome . get_root_home . should be_nil
4038 end
4139 end
4240end
You can’t perform that action at this time.
0 commit comments