[Ovirt-devel] [PATCH] wrappers for taskomatic.rb and host-status.rb

steve linabery slinabery at gmail.com
Sat May 3 22:38:26 UTC 2008


On Sat, May 3, 2008 at 9:01 AM, Chris Lalancette <clalance at redhat.com> wrote:
> steve linabery wrote:
>  > Hi Hugh and ovirt,
>  >
>  > Well, it turns out it is even simpler than that. All I really needed
>  > to do was look at host-keyadd, which cooperates well with daemon &
>  > killproc by doing 'include Daemonize' and calling 'daemonize', as
>  > you'll see in the attached patch.
>  >
>  > Patch adjusts taskomatic.rb and host-status.rb accordingly, and now
>  > they play nice with /etc/init.d/ovirt-wui script.
>
>  Steve,
>      OK, this could just be my weak understanding of Ruby, but isn't this patch
>  essentially the same as what it was before?  That is, isn't:
>
>  require 'daemons'
>  Daemons.daemonize
>
>  equivalent to
>
>  require 'daemons'
>  include Daemonize
>  daemonize
>
>  ?  If it works, I'm totally cool with the patch; I'd just like to understand the
>  difference between the two code snippets.
>
>  Chris Lalancette
>

Hi Chris,

I believe the difference is that you used 'include Daemonize',
although I don't know exactly what the difference is.

'include' seems to make the methods of the included module part of the
class that calls include. So I think there is a difference between
calling Daemons.daemonize (where the code presumably executes "in" the
Daemons class?) and daemonize after the include.

I think there may also be some slight difference between using the
daemonize method in Daemons versus that in Daemonize...even though if
you look at the source for Daemons.daemonize(options) it looks like it
might be a wrapper for Daemonize.daemonize.

I haven't read enough about how ruby's Process to know exactly how
ruby is interacting with the unix environment and how Daemonize might
differ from Daemons.

I defer to a greater ruby master than myself on this topic and merely
note that "it works".

Have a good weekend,
Steve




More information about the ovirt-devel mailing list