From fe295df3a8ef5048bcfaa068d723f6b1f73f2f4d Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 4 Apr 2011 12:13:44 +0200 Subject: [PATCH] daemon.py: move startup log message before prep_fn Before this, the output in the rapi daemon log was: 2011-04-04 03:09:51,026: ganeti-rapi pid=17447 INFO Reading users file at /var/lib/ganeti/rapi/users 2011-04-04 03:09:51,027: ganeti-rapi pid=17447 INFO ganeti-rapi daemon startup Which is confusing, as it might look like the read of the users file is part of the previous run. This is because we log the 'daemon startup' message after the prepare_fn, which can log things on its own. The patch simply moves the 'daemon startup' message just before prepare_fn call. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/daemon.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/daemon.py b/lib/daemon.py index 12acc6421..6d6bd743d 100644 --- a/lib/daemon.py +++ b/lib/daemon.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2006, 2007, 2008, 2010 Google Inc. +# Copyright (C) 2006, 2007, 2008, 2010, 2011 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -682,11 +682,11 @@ def GenericMain(daemon_name, optionparser, utils.WritePidFile(utils.DaemonPidFileName(daemon_name)) try: try: + logging.info("%s daemon startup", daemon_name) if callable(prepare_fn): prep_results = prepare_fn(options, args) else: prep_results = None - logging.info("%s daemon startup", daemon_name) except Exception, err: utils.WriteErrorToFD(wpipe, _BeautifyError(err)) raise -- GitLab