Skip to content

feat: add register, changed_when, failed_when, and ignore_errors#230

Merged
josegonzalez merged 1 commit intomainfrom
210-add-register-changed-when-failed-when-and-ignore-errors
Apr 29, 2026
Merged

feat: add register, changed_when, failed_when, and ignore_errors#230
josegonzalez merged 1 commit intomainfrom
210-add-register-changed-when-failed-when-and-ignore-errors

Conversation

@josegonzalez
Copy link
Copy Markdown
Member

Summary

Activates the four envelope keys reserved by #205. After each task runs, failed_when overrides the failure verdict (clearing both the error and any state-mismatch when falsy, matching Ansible), then changed_when overrides the changed flag, then register snapshots the post-override result for later tasks to read at .registered.<name>. ignore_errors: true keeps the run going past an erroring task on the apply path; the error event still emits with (ignored) in human output and ignored: true in JSON.

Loop expansions accumulate per-iteration states under Results and roll up the embedded Changed / Error fields Ansible-style: registered.foo.Changed is true if any iteration changed, while registered.foo.Results[i] carries the per-iteration state. The registered map is shared across plays in one docket invocation; duplicate register: names surface as a parse-time register_duplicate problem in validate.

Probe-error stderr is plumbed through a new *subprocess.ExecError wrapper so failed_when: 'result.Stderr contains ...' works on the plan-probe path too without changing every probe helper signature.

Closes #210.

Activates the four envelope keys reserved by #205. After each task
runs, `failed_when` overrides the failure verdict (clearing both the
error and any state-mismatch when falsy, matching Ansible), then
`changed_when` overrides the changed flag, then `register` snapshots
the post-override result for later tasks to read at
`.registered.<name>`. `ignore_errors: true` keeps the run going past
an erroring task on the apply path; the error event still emits with
`(ignored)` in human output and `ignored: true` in JSON. Loop
expansions accumulate per-iteration states under `Results` and roll
up the embedded `Changed` / `Error` fields Ansible-style.

The registered map is shared across plays in one docket invocation;
duplicate `register:` names surface as a parse-time
`register_duplicate` problem in `validate`. Probe-error stderr is
plumbed through a new `*subprocess.ExecError` wrapper so
`failed_when: 'result.Stderr contains ...'` works on the plan-probe
path too without changing every probe helper signature.
@josegonzalez josegonzalez changed the title feat: add register, changed_when, failed_when, and ignore_errors Add register, changed_when, failed_when, and ignore_errors Apr 29, 2026
@josegonzalez josegonzalez changed the title Add register, changed_when, failed_when, and ignore_errors feat: add register, changed_when, failed_when, and ignore_errors Apr 29, 2026
@josegonzalez josegonzalez merged commit 0c93315 into main Apr 29, 2026
10 checks passed
@josegonzalez josegonzalez deleted the 210-add-register-changed-when-failed-when-and-ignore-errors branch April 29, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add register, changed_when, failed_when, and ignore_errors

1 participant