tasks¶
- class fabric.tasks.ConnectionCall(*args, **kwargs)¶
Subclass of
invoke.tasks.Callthat generatesConnections.- __init__(*args, **kwargs)¶
Creates a new
ConnectionCall.Performs minor extensions to
Call– see its docstring for most details. Only specific-to-subclass params are documented here.- Parameters
init_kwargs (dict) – Keyword arguments used to create a new
Connectionwhen the wrapped task is executed. Default:None.
- class fabric.tasks.Task(*args, **kwargs)¶
Extends
invoke.tasks.Taskwith knowledge of target hosts and similar.As
invoke.tasks.Taskrelegates documentation responsibility to its@taskexpression, so we relegate most details to our version of@task- please see its docs for details.New in version 2.1.
- fabric.tasks.task(*args, **kwargs)¶
Wraps/extends Invoke’s
@taskwith extra kwargs.See
the Invoke-level API docsfor most details; this Fabric-specific implementation adds the following additional keyword arguments:- Parameters
hosts –
An iterable of host-connection specifiers appropriate for eventually instantiating a
Connection. The existence of this argument will trigger automatic parameterization of the task when invoked from the CLI, similar to the behavior of--hosts.Note
This parameterization is “lower-level” than that driven by
--hosts: if a task decorated with this parameter is executed in a session where--hostswas given, the CLI-driven value will win out.List members may be one of:
A string appropriate for being the first positional argument to
Connection- see its docs for details, but these are typically shorthand-only convenience strings likehostname.example.comoruser@host:port.A dictionary appropriate for use as keyword arguments when instantiating a
Connection. Useful for values that don’t mesh well with simple strings (e.g. statically defined IPv6 addresses) or to bake in more complex info (egconnect_timeout,connect_kwargsparams like auth info, etc).
These two value types may be mixed together in the same list, though we recommend that you keep things homogenous when possible, to avoid confusion when debugging.
Note
No automatic deduplication of values is performed; if you pass in multiple references to the same effective target host, the wrapped task will execute on that host multiple times (including making separate connections).
New in version 2.1.