module

Krikri::PluginHelpers::StrictBoolValidation

Strict type: bool param validation - a matches ansible-core's check_type_bool

  • boolean() + the parameters.py failure wrapper, shared by BasePlugin (module-side argspec validation) and the controller-side action plugins that real validates the same way (assert).

AnsibleModule validates every PROVIDED param's type at module setup, before any module logic: a type: bool option whose value is not a bool, one of the boolean literals (case-insensitive, whitespace-stripped), or the numbers 0/1 fails the module before anything runs, e.g. "argument 'remote_src' is of type str and we were unable to convert to bool: The value '/some/path' is not a valid boolean. Valid booleans include: ...". Previously the lenient BasePlugin#true? treated any non-empty string as truthy, so a typo'd or mis-templated bool param silently flipped behavior (force:/remove:/backup: class flags) where Ansible never gets past argument validation.

A plugin opts in by overriding #bool_params with its module's documented type: bool options (ansible-doc -j <module>, in real argument-spec declaration order) and calling #validate_bool_params! where Ansible's module-setup validation would sit in its own arg-check ordering (top of #execute for plain modules; after the unsupported-params/mutually-exclusive gates for the plugins that hand-roll those first, matching arg_spec.py's check order).