class

Krikri::PauseActionPlugin

Inherits Krikri::ActionPlugin < Reference < Object

pause: (ansible.builtin.pause) as a controller-side action plugin - behavior matched to plugins/pause.cr. Sleeping here blocks this host's own execution fiber via Crystal's cooperative scheduler, the same wall-clock delay a subprocess sleep produced before, but without the subprocess (or, for a remote host, the SSH round trip) that used to carry it out. plugins/pause.cr is kept as a real, working binary for --async/manual invocation.

krikri has no interactive TTY/prompt model, so it never blocks on stdin - which matches Ansible's own non-interactive behavior (verified against ansible-core 2.14: with closed stdin and no duration, real pause warns "Not waiting for response to prompt as stdin is not interactive" and continues immediately, ok). The prompt text is display-only in Ansible: the result's stdout is ALWAYS "Paused for X seconds|minutes" computed from the actual elapsed wall-clock time (rounded to 2 decimals, minutes-unit divided by 60), never the requested amount and never the prompt text.

Ansible 2.19 semantics behavior matched to the Ansible module:

  • seconds/minutes are {'type': int}-validated BEFORE anything happens: float values truncate (1.5 -> 1), non-numerics fail the task (failed=True, no wait, no crash).
  • a computed duration below 1 second is clamped up to 1 (so minutes: 0 still waits ~1 second, and its elapsed-based stdout reads "Paused for 0.02 minutes", not "0.0").
  • delta is the integer elapsed seconds; never changed; runs under check mode (verified, not assumed).
  • with a duration, the action plugin WRITES to the console itself before waiting: "Pausing for <n> seconds" (plus " (output is hidden)" when echo: false), and - only when a prompt was given - a second line telling the user how to cut the wait short, which carries a trailing CR because Ansible prints it as display(msg + "\r") on a TTY it never actually reaches with non-interactive stdin. A duration expressed in minutes prints the CONVERTED second count (minutes: 1 -> "Pausing for 60 seconds"), not the minutes value.

Constants

INTERRUPT_HINT = "(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)\r"

The console line real appends to a duration-gated pause so the user knows a TTY-less run is just sleeping (pause.py's seconds branch). Its trailing CR is Ansible's, not ours.

Instance methods

execute

Execute action on controller Returns: modified params to send to remote plugin, or nil if action failed

Source