[Freeipa-devel] [PATCH] 0014 Add final debug message in installers
Petr Viktorin
pviktori at redhat.com
Tue Apr 17 14:37:34 UTC 2012
On 04/17/2012 04:12 PM, John Dennis wrote:
> There have been so many versions of the patch and various comments
> attached to it I'm afraid I'm still trying to wrap my head around what
> the actual problem is we're trying to solve, until I have that
> understanding I can't evaluate the proposed solution.
>
> Could you please state simply what the fundamental problem is the patch
> is trying to correct for and how it accomplishes it?
The fundamental problem is in
https://fedorahosted.org/freeipa/ticket/2071: the install tools need to
put a final message in their logs, which states whether the command
succeeded or not, and if not, what the error was.
The patch needs to do this with minimal modifications to the scripts, so
that it doesn't break any functionality.
It accomplishes this by wrapping the scripts' top-level code in a
context manager. When the script is done, the context manager looks
whether an exception was raised and logs an appropriate message.
The current problem is that some tools configure logging to the console,
so this extra message ends up both in both the log file and on the console.
The tools themselves also write their errors to the console (via print,
SystemExit, or traceback), so the error appears twice.
Since I do not want to add an extra message to the console, but only
want it in a log file (if the tool uses one), I remove the console log
handler before logging the message.
> When I tried to reach this understanding myself about the only thing I
> figured out was that some of our command line utilities pass a string to
> the exit() command whose output is out of band with respect to logging
> resulting in a duplicate message (however before application of the
> patch I don't see why logging would re-emit the message).
Yes, that's exactly right. The output to console was fine, it should
stay as it was before the patch.
--
Petr³
More information about the Freeipa-devel
mailing list