pyinfra.api.host module¶
-
class
pyinfra.api.host.Host(name: str, inventory: Inventory, groups, executor=<module 'pyinfra.connectors.ssh' from '/home/runner/work/pyinfra/pyinfra/pyinfra/connectors/ssh.py'>)¶ Bases:
objectRepresents a target host. Thin class that links up to facts and host/group data.
-
check_can_rsync()¶
-
connect(reason=None, show_errors: bool = True, raise_exceptions: bool = False)¶ Connect to the host using it’s configured connector.
-
property
connected: bool¶
-
connection= None¶
-
connector_data: Dict[str, Any]¶
-
create_fact(name_or_cls, data=None, kwargs=None)¶ Create a new fact for this host in the fact cache.
-
current_deploy_data= None¶
-
current_deploy_kwargs= None¶
-
current_deploy_name: str | None = None¶
-
current_op_global_kwargs: Dict[str, Any]¶
-
current_op_hash: str | None = None¶
-
delete_fact(name_or_cls, kwargs=None)¶ Remove an existing fact for this host in the fact cache.
-
deploy(name: str, kwargs, data, in_deploy: bool = True)¶ Wraps a group of operations as a deploy, this should not be used directly, instead use
pyinfra.api.deploy.deploy.
-
disconnect()¶ Disconnect from the host using it’s configured connector.
-
executing_op_hash= None¶
-
get_deploy_data()¶
-
get_fact(name_or_cls, *args, **kwargs)¶ Get a fact for this host, reading from the cache if present.
-
get_file(*args, **kwargs)¶ Low level method to download a file from the host via it’s configured connector.
-
property
group_data¶
-
property
host_data¶
-
in_deploy: bool = False¶
-
in_op: bool = False¶
-
loop(iterable)¶
-
loop_position: List[int]¶
-
nested_executing_op_hash= None¶
-
noop(description)¶ Log a description for a noop operation.
-
property
print_prefix¶
-
put_file(*args, **kwargs)¶ Low level method to upload a file to the host via it’s configured connector.
-
reload_fact(name_or_cls, *args, **kwargs)¶ Get a fact for this host without using any cached value, always re-fetch the fact data from the host and then cache it.
-
rsync(*args, **kwargs)¶
-
run_shell_command(*args, **kwargs)¶ Low level method to execute a shell command on the host via it’s configured connector.
-
style_print_prefix(*args, **kwargs)¶
-
-
class
pyinfra.api.host.HostData(host: Host, *datas)¶ Bases:
objectCombines multiple AttrData’s to search for attributes.
-
dict()¶
-
get(key: str, default=None)¶
-
override_datas: Dict[str, Any]¶
-
-
pyinfra.api.host.extract_callable_datas(datas: List[Callable[[...], Any] | Any]) Generator[Any, Any, Any]¶
pyinfra 2.x