HomeClusterLabs Projects

Refactor: tools: Skip mismatch check for crm_shadow --create-empty

Description

Refactor: tools: Skip mismatch check for crm_shadow --create-empty

Throw an instance mismatch error only for --commit, --delete, and
--reset. Previously, we were doing it for everything except --create.
But --create-empty is functionally identical to --create in this context.

That leaves only --commit, --delete, and --reset by the time we reach
this block. Here we'll make the comparisons to those explicitly instead of
just excluding --create and --create-empty. Not using a switch statement
because of the level of indentation required. This will all go away soon
when we finish functionizing all commands.

We throw a mismatch warning on --commit because it could overwrite the
cluster. We throw a mismatch warning on --delete and --reset because it
could destroy/overwrite a shadow instance different from the one the
user expects. The user might commonly intend to operate on the current
instance but accidentally grab an old command that targets a different
instance, for example.

Soon we'll update the warning message to differentiate between danger to
the cluster and danger to a shadow file.

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

Details

Provenance
nrwahl2Authored on Mar 6 2023, 6:00 AM
Parents
rP6dc8c817bdef: Refactor: tools: De-functionize crm_shadow.c:cmd_is_dangerous()
Branches
Unknown
Tags
Unknown