class

Krikri::PluginResult

Inherits Reference < Object

Plugin result structure with diff support

Constructors

new(changed : Bool, failed : Bool, msg : String = "", diff : JSON::Any | Nil = nil, omit_changed : Bool = false, include_empty_msg : Bool = false, native_msg : JSON::Any | Nil = nil, key_order : Array(String) | Nil = nil, **kwargs)
Source

Instance methods

changed=(changed : Bool)
Source
changed?
Source
diff
Source
diff=(diff : JSON::Any | Nil)
Source
extra
Source
extra=(extra : Hash(String, JSON::Any))
Source
failed=(failed : Bool)
Source
failed?
Source
include_empty_msg=(include_empty_msg : Bool)
Source
include_empty_msg?
Source
key_order

Optional wire-key order for the serialized result. Ansible's registered result is the module's own dict in ITS insertion order (exit_json's msg/status_code kwargs first, then the module's result dict, then add_path_info's stat block) - every module has its own, while PluginResult's fixed leading keys (changed/exception/failed/ msg/diff) impose one engine-wide shape. When set, #to_json emits the listed keys first, in the listed order (absent ones skipped), then every remaining key in its current order; nil keeps the historical order on SUCCESS results, while a FAILED result without a key_order takes Ansible's plain fail_json order (failed, msg, then extras, then changed, then exception - see #to_json). Observed programmatically (e.g. {{ r | to_json }}, {{ r }} in a debug msg) rather than in the -v dump, which real sorts alphabetically via _dump_results(sort_keys=True).

Source
key_order=(key_order : Array(String) | Nil)

Optional wire-key order for the serialized result. Ansible's registered result is the module's own dict in ITS insertion order (exit_json's msg/status_code kwargs first, then the module's result dict, then add_path_info's stat block) - every module has its own, while PluginResult's fixed leading keys (changed/exception/failed/ msg/diff) impose one engine-wide shape. When set, #to_json emits the listed keys first, in the listed order (absent ones skipped), then every remaining key in its current order; nil keeps the historical order on SUCCESS results, while a FAILED result without a key_order takes Ansible's plain fail_json order (failed, msg, then extras, then changed, then exception - see #to_json). Observed programmatically (e.g. {{ r | to_json }}, {{ r }} in a debug msg) rather than in the -v dump, which real sorts alphabetically via _dump_results(sort_keys=True).

Source
msg=(msg : String)
Source
msg_native

A NATIVE-typed msg override (JSON::Any): Ansible modules that pass a non-string value to fail_json/exit_json keep its Python type in the wire result (fail's action puts the raw task arg in result['msg'], so fail: {msg: 50} registers and dumps the INT 50, not "50") - the strings-only @msg cannot carry that. When set it replaces @msg in the serialized result entirely; @msg stays "" (the display layer re-renders a non-string msg through Python repr for its error blocks).

Source
msg_native=(msg_native : JSON::Any | Nil)

A NATIVE-typed msg override (JSON::Any): Ansible modules that pass a non-string value to fail_json/exit_json keep its Python type in the wire result (fail's action puts the raw task arg in result['msg'], so fail: {msg: 50} registers and dumps the INT 50, not "50") - the strings-only @msg cannot carry that. When set it replaces @msg in the serialized result entirely; @msg stays "" (the display layer re-renders a non-string msg through Python repr for its error blocks).

Source
omit_changed=(omit_changed : Bool)
Source
omit_changed?
Source
to_json(io : IO) : Nil
Source