HomeClusterLabs Projects

Refactor: tools: New shadow message in crm_shadow

Description

Refactor: tools: New shadow message in crm_shadow

This will allow us to support XML output in crm_shadow. There are four
commands that produce output other than instructions to the user. All
are queries: "--which", "--file", "--display", and "--diff".

We use quiet mode with text output format to maintain the existing
crm_shadow output. Note that if multiple fields are requested by the
flags argument but one or more of the corresponding field arguments are
NULL, the output will appear ambiguous. For example, if
shadow_disp_instance and shadow_disp_filename are both set, but the
instance argument is NULL, only one line will appear in the output, with
no indication of which one it is. However, a reasonable caller can avoid
this. Also, it will probably be rare in practice to request multiple
fields.

The default message function (also used with non-quiet text output
objects) prints a header before each line and indicates if a requested
field is missing. This is clearer but diverges from the existing
behavior.

An alternative would be a boolean show_headers argument, but that's yet
another argument that the XML function would ignore.

Only the quiet-mode text output and the XML output are planned for use
in crm_shadow. The default output is preparation for moving the message
functions into libpacemaker.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Feb 22 2023, 10:25 PM
Parents
rPe4607b163eb9: Refactor: tools: New instruction message in crm_shadow
Branches
Unknown
Tags
Unknown