pyinfra.api.state module

class pyinfra.api.state.BaseStateCallback

Bases: object

static host_before_connect(state, host)
static host_connect(state, host)
static host_connect_error(state, host, error)
static host_disconnect(state, host)
static operation_end(state, op_hash)
static operation_host_error(state, host, op_hash)
static operation_host_start(state, host, op_hash)
static operation_host_success(state, host, op_hash)
static operation_start(state, op_hash)
class pyinfra.api.state.State(inventory=None, config=None, **kwargs)

Bases: object

Manages state for a pyinfra deploy.


Flag a host as active.

config = None
current_deploy_filename = None
current_exec_filename = None
current_op_global_kwargs = None
current_op_hash = None
deploy(name, kwargs, data, in_deploy=True, deploy_op_order=None)

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_name = None
deploy_op_order = 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_data(host, op_hash)
get_temp_filename(hash_key=None, hash_filename=True)

Generate a temporary filename for this deploy.

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

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

loop_counter = None
loop_filename = None
loop_line = None
pool = None
print_fact_info = False
print_fact_input = False
print_fact_output = False
print_input = False
print_noop_info = False
print_output = False
trigger_callbacks(method_name, *args, **kwargs)