Please review pull request #774: (13914) Fix ownership of log files opened by (sciurus)

Description:

The puppet master creates log files while running as the root user,
then switches to running as the puppet user. This commit ensures it
will still have permission to write to the log file after switching users.

  • Opened: Mon May 14 20:05:27 UTC 2012
  • Based on: puppetlabs:master (639f995c91289b3be9ca5347865247907c7dcb5c)
  • Requested merge: sciurus:13914 (b7dbb2b4194f3e01f76e84a939bf0e941a582418)

Diff follows:

diff --git a/lib/puppet/util/log/destinations.rb b/lib/puppet/util/log/destinations.rb
index 22fcb36..65e2853 100644
--- a/lib/puppet/util/log/destinations.rb
+++ b/lib/puppet/util/log/destinations.rb
@@ -76,6 +76,9 @@ def initialize(path)
     # create the log file, if it doesn't already exist
     file = File.open(path, File::WRONLY|File::CREAT|File::APPEND)
 
+    # Give ownership to the user and group puppet will run as
+    FileUtils.chown(Puppet[:user], Puppet[:group], path)
+
     @file = file
 
     @autoflush = Puppet[:autoflush]

    

--
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