|
|
| |
Rex::Task(3) |
User Contributed Perl Documentation |
Rex::Task(3) |
Rex::Task - The Task Object
The Task Object. Typically you only need this class if you want to manipulate
tasks after their initial creation.
use Rex::Task;
# create a new task
my $task = Rex::Task->new( name => 'testtask' );
$task->set_server('remoteserver');
$task->set_code( sub { say 'Hello'; } );
$task->modify( 'no_ssh', 1 );
# retrieve an existing task
use Rex::TaskList;
my $existing_task = Rex::TaskList->create->get_task('my_task');
This is the constructor.
$task = Rex::Task->new(
func => sub { some_code_here },
server => [ @server ],
desc => $description,
no_ssh => $no_ssh,
hidden => $hidden,
auth => {
user => $user,
password => $password,
private_key => $private_key,
public_key => $public_key,
},
before => [sub {}, sub {}, ...],
after => [sub {}, sub {}, ...],
around => [sub {}, sub {}, ...],
before_task_start => [sub {}, sub {}, ...],
after_task_finished => [sub {}, sub {}, ...],
name => $task_name,
executor => Rex::Interface::Executor->create,
opts => {key1 => val1, key2 => val2, ...},
args => [arg1, arg2, ...],
);
Returns the current connection object.
Returns the current executor object.
Returns true if the task is hidden. (Should not be displayed on ,,rex -T''.)
Returns the servers on which the task should be executed as an ArrayRef.
With this method you can set new servers on which the task should be executed
on.
Delete every server registered to the task.
Returns the current server on which the tasks gets executed right now.
Returns the description of a task.
Set the description of a task.
Returns true (1) if the task will be executed remotely.
Returns true (1) if the task gets executed on the local host.
Returns true (1) if the task gets executed over http protocol.
Returns true (1) if the task gets executed over https protocol.
Returns true (1) if the task gets executed with openssh.
Returns true (1) if the task will establish a connection to a remote system.
This method tries to guess the right connection type for the task and returns
it.
Current return values are below:
With this method you can modify values of the task.
Deletes current connection object.
Returns the username the task will use.
Set the username of a task.
Returns the password that will be used.
Set the password of the task.
Returns the name of the task.
Returns the code of the task.
Set the code of the task.
This method is used internally to execute the specified hooks.
Set the authentication of the task.
$task->set_auth("user", "foo");
$task->set_auth("password", "bar");
Merges the authentication information from $server into
the task. Tasks authentication information have precedence.
Returns the sudo password.
Get the parallelism count of a task.
Set the parallelism of the task.
Initiate the connection to $server.
Disconnect from the current connection.
Run the task on $server, with
%options.
Modify $task, by setting $key to
$value.
Returns true(1) if the passed object is a task.
Returns description of task.
Returns true if rex should exit on connect failure.
Sets if rex should exit on connect failure.
Returns arguments of task.
Visit the GSP FreeBSD Man Page Interface. Output converted with ManDoc. |