HomeClusterLabs Projects

Fix: tools: Rework error reporting and exiting in crm_mon.

Description

Fix: tools: Rework error reporting and exiting in crm_mon.

Getting this right is complicated. There's a lot of competing
requirements that makes it difficult. Here's what this patch is
attempting to do:

  • Use GError for holding the error messages that occur in crm_mon where

we basically immediately call clean_up. This is kind of like an
exception, if you squint. The purpose of this is to delay printing the
error messages or having to find another place to store them.

  • If we're in curses mode, shut down curses before printing error

messages. If curses is still active, the error message will be printed
and then curses shut down very soon after which restores the screen to
its pre-crm_mon state. This leaves very little time to see the error
message, basically making it like it was never printed.

  • Usage-related errors should also have the help output printed, but not

for things like XML or HTML. The user probably doesn't care about
seeing help output in those cases. For XML at least, the fact that it's
a usage-related error will be added.

  • All other errors should be printed as formatted output, as long as

we're not in curses mode. This means that they should appear in XML or
HTML or whatever other future formats are supported.

  • Some error messages occur before formatted output has been set up. In

that case, just make sure they are printed to the screen regardless of
which format was eventually going to be requested.

  • In the normal case where there's no error of any kind, print the

output of the program in the requested format.

Details

Provenance
clumensAuthored on Feb 26 2020, 3:13 PM
Parents
rP97446a3fde62: Fix: tools: Don't automatically show cluster options in crm_mon.
Branches
Unknown
Tags
Unknown

Event Timeline