Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: document any_changed, all_changed helpers for _if #1250

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/api/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Operations can also call other operations using ``yield from`` syntax:
yield from files.file._inner(
path="/some/file",
...,

# Only arguments for the operation itself are allowed, global arguments
# such as e.g. _sudo are not accepted.
)
```

Expand Down
5 changes: 5 additions & 0 deletions docs/using-operations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ All operations return an operation meta object which provides information about
_if=lambda: create_user.did_change() or create_otheruser.did_change(),
)

# The functions `any_changed` and `all_changed` are provided for common use cases, e.g.
from pyinfra.operations.utils import any_changed, all_changed
server.shell(commands=["..."], _if=any_changed(create_user, create_otheruser))
server.shell(commands=["..."], _if=all_changed(create_user, create_otheruser))

Operation Output
~~~~~~~~~~~~~~~~

Expand Down