pyinfra.api.state module

class pyinfra.api.state.State(inventory=None, config=None, **kwargs)

Bases: object

Manages state for a pyinfra deploy.

activate_host(host)

Flag a host as active.

config = None
current_op_file = 0
current_op_hash = None
deploy(name, kwargs, data, line_number, in_deploy=True)

Wraps a group of operations as a deploy, this should not be used directly, instead use pyinfra.api.deploy.deploy.

deploy_data = None
deploy_dir = None
deploy_kwargs = None
deploy_line_numbers = None
deploy_name = None
deploying = False
fail_hosts(hosts_to_fail, activated_count=None)

Flag a set of hosts as failed, error for config.FAIL_PERCENT.

get_op_order()
get_temp_filename(hash_key=None)

Generate a temporary filename for this deploy.

hosts(hosts)
in_deploy = False
in_op = False
init(inventory, config, initial_limit=None)
initialised = False
inventory = None
is_host_in_limit(host)

Returns a boolean indicating if the host is within the current state limit.

limit(hosts)
loop_counter = None
loop_line = None
pool = None
preserve_loop_order(items)
print_fact_info = False
print_fact_input = False
print_fact_output = False
print_input = False
print_output = False
when(predicate)