Bcfg2/bcfg2 — pull request #45 by zultron (2012-09-02 16:54:34+00:00)
Title: bcfg2-server not daemonizing correctly

Not sure this is strictly a pull request, since it's just a hack to get me running quickly. Maybe more of a bug report. Thanks-

John

Two issues:

- self._daemonize() checks if it's the parent process after a fork and
if so, returns; but this code seems to have been pasted from the old
versions, where it would return to bcfg2-server's __main__ control
path and exit. This patch pastes that code back into the run()
which returns back to where we expect, instead of right into the
XMLRPCServer startup code. AFAICT, the _daemonize() code doesn't
actually need to be in the Core.py module, since the cherrypy code
doesn't need it.

- The _ _ main _ _ code path initializes the fam thread before the calls
to fork(). That causes bad things to happen when the parent PID
tries to exit. This patch inits the fam thread only for the
cherrypy backend, and starts the fam thread after the forking is
done. (I have no idea if this is the right place to do that, but it
gets me running.)