module

Krikri::ArgspecValidator

Constants

ASSEMBLE_ACTION_CONSUMED = ["remote_src", "regexp", "delimiter", "ignore_hidden", "decrypt"]

The assemble-only options Ansible's action plugin consumes itself and never forwards to the copy module it delegates to when remote_src: is falsy (assemble.py action's clean-up loop).

BOOL_FALSE_CHOICES = {"n", "no", "off", "0", "false", "f", "False"}
BOOL_TRUE_CHOICES = {"y", "yes", "on", "1", "true", "t", "True"}

ansible.module_utils.parsing.convert_bool.BOOLEANS_TRUE/FALSE's string members - the choices a 'True'/'False' value can rewrite to when exactly one of them appears in an option's choices list. Python's True/False are members of those same sets (True == 1), so a native-bool choice rendered as "True"/"False" (Python repr) overlaps too - without them a bool-typed choices option like docker_container's pull refuses a value real accepts.

BOOLEANS_REPR = ["'off'", "1", "'true'", "'y'", "0", "'false'", "'on'", "'no'", "'1'", "'yes'", "'0'", "'n'", "'f'", "'t'"] of ::String

convert_bool.py's BOOLEANS as Ansible's error message reprs them (a Python set iteration - order differs between module processes, so this fixed order is one Ansible emits; only the membership is stable).

INTERNAL_KEYS = ["_module_name", "_first_gather", "_environment", "_verbosity", "_rendered_from_template", "_content_checksum", "__original_src_basename", "__original_src_path", "__cleanup_after_copy", "__cleanup_after_copy_dir", "__cleanup_after_unarchive", "__cleanup_after_script", "__script_tmp_dir", "__script_ssh_addr", "__script_pty_term", "__raw_pty_merge", "__raw_pty_term", "__cleanup_after_assemble", "__precomputed_match", "__precomputed_checksum"]
PACKAGE_MANAGERS = ["apt", "apt_rpm", "dnf", "dnf5", "yum", "yum4", "dnf4", "zypper", "pacman", "apk", "homebrew", "pkgng", "openbsd_pkg", "pkgin", "portage", "xbps", "slackpkg", "swupd", "urpmi", "opkg", "pkg5", "rpm_ostree_pkg", "macports", "bsd_pkg"] of ::String

Kept out of validation: engine-internal wire keys Ansible's module never sees (real strips the ansible* namespace generically; the others are krikri's own bookkeeping keys). Package-manager modules package: use: can name (core + common community).

REAL_FALSE = ["n", "no", "off", "0", "false", "f"] of ::String
REAL_TRUE = ["y", "yes", "on", "1", "true", "t"] of ::String
SYSTEMD_UNUSED_PARAMS = {"pattern", "runlevel", "sleep", "arguments", "args"}

Instance methods

failure_kind?(module_name : String, msg : String) : Symbol | Nil

Whether this msg on this module is an argspec-validation failure we emitted (used by ResultDisplay to pick the right error-block chain shape - template's own file-not-found chain must not swallow these).

Source
invocation_args(module_name : String, params : Hash(String, String)) : Hash(String, JSON::Any) | Nil

invocation.module_args of a module result: every spec option under its canonical name, the provided (type-converted) value or its default (null when none). nil for a module without a spec or an action-plugin module whose result carries no invocation.

Source
option_type(module_name : String, option : String) : String | Nil

The declared type of one module option from the argspec table ("raw", "str", "list", ... - AnsibleModule's implicit default is str), or nil when the module or option is unknown to the table. Lets non-validation callers (the parser's mode-octal rescue) ask how the real module would interpret a value without duplicating the table.

Source
validate(action_name : String, module_name : String, params : Hash(String, String), vars_context : Hash(String, JSON::Any)) : Failure | Nil

Validates one module invocation's params against the real spec. action_name is the module spelling AS WRITTEN in the task (real prints that in the Unsupported-parameters message, except for the delegating action plugins with a fixed name); module_name is the resolved FQCN the table is keyed by. Returns nil when nothing fails (or the module has no spec to check against).

Source

Nested types