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.

activate_host(host)

Flag a host as active.

add_callback_handler(handler)
add_will_add_user(username)
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_data(host, op_hash)
get_op_meta(op_hash)
get_op_order()
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
is_host_in_limit(host)

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

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_noop_info = False
print_output = False
to_dict()
trigger_callbacks(method_name, *args, **kwargs)
will_add_user(username)