HomeClusterLabs Projects

Fix: libcrmcommon: Don't parse "-INFINITY" as a list of cmdline options

Description

Fix: libcrmcommon: Don't parse "-INFINITY" as a list of cmdline options

For the crm_attribute -p -v -INFINITY command, when the resource (the
-p argument) is specified via the OCF_RESOURCE_INSTANCE environment
variable rather than explicitly on the command line, the string
"-INFINITY" is parsed incorrectly.

pcmk__cmdline_preproc() treats the leading 'I' as an argument but skips
it because it's not in the special string. It then parses the 'N', finds
it in the special string, and treats "FINITY" as N's argument. As a
result, crm_attribute looks for a node (-N specifies a node) named
"FINITY" instead of treating "-INFINITY" as the value to update the
promotion score.

We should handle "-INFINITY" as a string and let GLib handle it instead.

Fixes CLBZ#5509

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

Details

Provenance
nrwahl2Authored on Mar 7 2023, 3:48 AM
Parents
rP99de590ab7d2: Test: cts-cli: crm_attribute -p with -INFINITY and resource in env var
Branches
Unknown
Tags
Unknown