[ClusterLabs] Antw: Re: Where is the syntax for parameter types?
Ulrich.Windl at rz.uni-regensburg.de
Wed Oct 16 05:31:58 EDT 2019
>>> Oyvind Albrigtsen <oalbrigt at redhat.com> schrieb am 16.10.2019 um 11:02 in
Nachricht <20191016090219.z5jz4tnd5hxi7xpf at redhat.com>:
> On 16/10/19 10:53 +0200, Ulrich Windl wrote:
>>I just discovered an interesting problem with my own RA that allows a
>>Where is the exact syntax for "boolean" defined, and who's responsible for
> checking it? The RA or (e.g.) crm?
>>The concrete problem is that my RA expected the boolean parameter to be
> either '0' or '1', but crm shell was happy with the value "true".
>>So where is the document describing the parameter types' syntax, and who is
> responsible for checking that? RA's validate‑all?
> This is done by the validate‑all action for the RA.
> Sounds like the agent should use "ocf_is_true" instead of checking
> against a specific value.
In addition to what I had said before (doesn't help the user when enetring),
the function is like this:
case "$1" in
yes|true|1|YES|TRUE|True|ja|on|ON) true ;;
*) false ;;
Probably the Spanish and French envy Germans now ;-)
(their "yes" isn't included)
So it seems:
The management tools do not "normalize" Boolean values, but keep them "as is",
and they don't verify those. Id' still prefer some concrete syntax, so that a
Boolean is either true, false or an error.
The implementation treats everything not "true" as "false" which is basically
a wrong implementation:
If you have ocf_is_decimal() returning true if the syntax is a decimal number,
the corresponding function for Boolean is not ocf_is_true(), but
ocf_is_boolean(), returning flase if the value is not Boolean (not if the value
This isn't a well-designed library of functions.
So if you add an ocf_is_false() (which is NOT !ocf_is_true()), you could
if ! ocf_is_false $val && ! ocf_is_true $val
error "$val is not a Boolean value"
ocf_is_false "$1" || ocf_is_true "$1"
> Feel free to create a pull request or issue on
>>Manage your subscription:
>>ClusterLabs home: https://www.clusterlabs.org/
> Manage your subscription:
> ClusterLabs home: https://www.clusterlabs.org/
More information about the Users