pyinfra.api.facts module¶
The pyinfra facts API. Facts enable pyinfra to collect remote server state which is used to “diff” with the desired state, producing the final commands required for a deploy.
Note that the facts API does not use the global currently in context host so it’s possible to call facts on hosts out of context (ie give me the IP of this other host B while I operate on this host A).
-
class
pyinfra.api.facts.
FactBase
¶ Bases:
Generic
[T
]-
abstract
: bool = True¶
-
command
: Callable[[...], str | StringCommand]¶
-
static
default
() T ¶ Set the default attribute to be a type (eg list/dict).
-
name
: str¶
-
process
(output: Iterable[str]) T ¶
-
process_pipeline
(args, output)¶
-
requires_command
(*args, **kwargs) str | None ¶
-
shell_executable
: str | None = None¶
-
-
pyinfra.api.facts.
get_fact
(state: State, host: Host, cls: type[FactBase], args: Any | None = None, kwargs: Any | None = None, ensure_hosts: Any | None = None, apply_failed_hosts: bool = True) Any ¶