Previously, master would only change it working directory when it
daemonized, causing problems if it was started with no-daemonize
in a directory which was inaccessible to the puppet user. Now it
will daemonize as soon as it changes to the puppet user.

Signed-off-by: Nick Lewis <[email protected]>
---
 lib/puppet/application/master.rb     |    1 +
 spec/unit/application/master_spec.rb |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb
index 777a50e..7aef762 100644
--- a/lib/puppet/application/master.rb
+++ b/lib/puppet/application/master.rb
@@ -92,6 +92,7 @@ class Puppet::Application::Master < Puppet::Application
     if Puppet.features.root?
       begin
         Puppet::Util.chuser
+        Dir.chdir("/")
       rescue => detail
         puts detail.backtrace if Puppet[:trace]
         $stderr.puts "Could not change user to #{Puppet[:user]}: #{detail}"
diff --git a/spec/unit/application/master_spec.rb 
b/spec/unit/application/master_spec.rb
index 0baa822..fe99695 100644
--- a/spec/unit/application/master_spec.rb
+++ b/spec/unit/application/master_spec.rb
@@ -393,6 +393,7 @@ describe Puppet::Application::Master do
       it "should drop privileges if running as root" do
         Puppet.features.stubs(:root?).returns true
 
+        Dir.stubs(:chdir)
         Puppet::Util.expects(:chuser)
 
         @master.main
-- 
1.7.2

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to