Feature #63330

Allow node/application/deployment options as options of defined tasks

Added by Joachim Mathes almost 7 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Could have
Assignee:
-
Target version:
-
Start date:
2014-11-25
Due date:
% Done:

0%

Estimated time:

Description

Up to now it is possible to reuse a task like typo3.surf:shell with $workflow->defineTask('fooTask', 'typo3.surf:shell', array('command' => 'echo "Hello"')) and dedicated parameters. But what if I want node options to overwrite the parameters of a defined task, e.g.:

<?php

$nodeConfigurations = array(
    array(
        'name' => 'one',
        'run' => 'echo "I am node one"'
    ),
    array(
        'name' => 'two',
        'run' => 'echo "I am node two"'
    )
);

$application = new \TYPO3\Surf\Domain\Model\Application('DummyApplication');

foreach ($nodeConfigurations as $configuration) {
    $node = new \TYPO3\Surf\Domain\Model\Node($configuration['name']);
    $node
        ->setOptions(array(
            'hostname' => 'localhost',
            'username' => 'jo',
            'getNodeOptions[command]' => $configuration['run']
        ));

    $application
        ->addNode($node);
}

$workflow = new \TYPO3\Surf\Domain\Model\SimpleWorkflow();
$workflow
    ->defineTask('getNodeOptions', 'typo3.surf:shell', array())
    ->addTask('getNodeOptions', 'transfer');

$deployment
    ->setWorkflow($workflow)
    ->addApplication($application); 

This does not work for now. Maybe the provided patch is a solution. This is a quick idea, so please review carefully.

Also available in: Atom PDF