Bug#378382: Puppetmaster init script is still broken

2007-01-06 Thread Alex Owen

Puppet is now at version 0.20.1-1

Reading this bug report and the debian/changelog it seems the init
script was overhauled in the last upload (0.20.1-1) however it still
doe not work!

I do not use puppet but have installed puppetmaster on a "clean"
machine and touched
/etc/puppet/manifests/site.pp so that puppetmasterd starts!

I can now start the daemon with
sudo /etc/init.d/puppetmaster start
and a pid file is created BUT the pid file is EMPTY!
# ls -l /var/run/puppetmasterd.pid
-rw-r--r-- 1 puppet puppet 0 2007-01-06 17:08 /var/run/puppetmasterd.pid

So it is no wonder that the daemon is not stopped!

Further test show that by running /usr/sbin/puppetmasterd the pid file
is created (but empty)
and that killing the process removes the pid file.

I think the bug lies in the ruby code which creates an EMPTY pid
file... it should put the pid in it!


I do not read or write ruby... but I think the problem lies in
function setpidfile in the file puppet-0.20.1/lib/puppet/daemon.rb

The code looks like:
---
   def setpidfile
   return unless Puppet[:setpidfile]
   threadlock(:pidfile) do
   Puppet.config.use(:puppet)
   @pidfile = self.pidfile
   if FileTest.exists?(@pidfile)
   if defined? $setpidfile
   return
   else
   raise Puppet::Error, "A PID file already
exists for #{Puppet.name}
   at [EMAIL PROTECTED]  Not starting."
   end
   end

   Puppet.info "Creating PID file to %s" % @pidfile
   begin
   File.open(@pidfile, "w") { |f| f.puts $$ }
   rescue => detail
   Puppet.err "Could not create PID file: %s" % detail
   exit(74)
   end
   $setpidfile = true
   end
   end
---

BUT I don't see the file being closed or sync'd to disk. My suspision
is that ruby needs another command/method to be called to commit this
write to disk. Any ruby experts out there want to comment?

Regards
Alex Owen


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#378382: Puppetmaster init script is still broken

2007-01-07 Thread Matthew Palmer
On Sat, Jan 06, 2007 at 05:36:51PM +, Alex Owen wrote:
> I do not read or write ruby... but I think the problem lies in
> function setpidfile in the file puppet-0.20.1/lib/puppet/daemon.rb
> 
> The code looks like:
>Puppet.info "Creating PID file to %s" % @pidfile
>begin
>File.open(@pidfile, "w") { |f| f.puts $$ }
> 
> BUT I don't see the file being closed or sync'd to disk.

The File.open line automatically closes the file again as well after it
executes the closure.  Ruby magic at it's finest.

> My suspision
> is that ruby needs another command/method to be called to commit this
> write to disk. Any ruby experts out there want to comment?

While there's certainly *something* going on there, that ain't it.

As of 0.22.0, though, the PID file handling has been reworked, so this bug
will go away when that gets packaged.

- Matt


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]