Rollback awareness.

Tasks are aware if they are in rollbacks; they will be invoked only if
they implement the new interface RollbackAware.
This commit is contained in:
Andrs Montaez
2012-01-03 23:25:42 -02:00
parent 01cbd0e447
commit 9cf720c602
9 changed files with 70 additions and 23 deletions
+17 -13
View File
@@ -72,24 +72,28 @@ class Mage_Task_BuiltIn_Releases_Rollback
} else {
foreach ($tasksToRun as $taskName) {
$tasks++;
$task = Mage_Task_Factory::get($taskName, $this->_config);
$task->init();
Mage_Console::output('Running <purple>' . $task->getName() . '</purple> ... ', 2, false);
$result = $task->run();
if ($result == true) {
Mage_Console::output('<green>OK</green>', 0);
$completedTasks++;
} else {
Mage_Console::output('<red>FAIL</red>', 0);
$task = Mage_Task_Factory::get($taskName, $this->_config, true);
$task->init();
Mage_Console::output('Running <purple>' . $task->getName() . '</purple> ... ', 2, false);
if ($task instanceOf Mage_Task_Releases_RollbackAware) {
$tasks++;
$result = $task->run();
if ($result == true) {
Mage_Console::output('<green>OK</green>', 0);
$completedTasks++;
} else {
Mage_Console::output('<red>FAIL</red>', 0);
}
} else {
Mage_Console::output('<yellow>SKIPPED</yellow>', 0);
}
}
}
// Changing Release
Mage_Console::output('Releasing to <dark_gray>' . $releaseId . '</dark_gray> ... ', 2, false);
Mage_Console::output('Running <purple>Rollback Release [id=' . $releaseId . ']</purple> ... ', 2, false);
$userGroup = '';
$resultFetch = $this->_runRemoteCommand('ls -ld ' . $rollbackTo . ' | awk \'{print \$3\":\"\$4}\'', $userGroup);