Proper exit code. Issue #52

This commit is contained in:
Andrés Montañez
2014-08-06 21:43:29 -03:00
parent 8df5534470
commit 5d728a9105
14 changed files with 72 additions and 18 deletions
+10 -5
View File
@@ -28,19 +28,19 @@ class RollbackCommand extends AbstractCommand implements RequiresEnvironment
*/
public function run()
{
$result = false;
$exitCode = 450;
$releaseId = $this->getConfig()->getArgument(1);
if (!is_numeric($releaseId)) {
Console::output('<red>This release is mandatory.</red>', 1, 2);
return false;
return 451;
}
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
if (file_exists($lockFile)) {
Console::output('<red>This environment is locked!</red>', 1, 2);
echo file_get_contents($lockFile);
return null;
return 20;
}
// Run Tasks for Deployment
@@ -50,16 +50,21 @@ class RollbackCommand extends AbstractCommand implements RequiresEnvironment
Console::output('<light_purple>Warning!</light_purple> <dark_gray>No hosts defined, unable to get releases.</dark_gray>', 1, 3);
} else {
$result = true;
foreach ($hosts as $host) {
$this->getConfig()->setHost($host);
$this->getConfig()->setReleaseId($releaseId);
$task = Factory::get('releases/rollback', $this->getConfig());
$task->init();
$result = $task->run();
$result = $task->run() && $result;
}
if ($result) {
$exitCode = 0;
}
}
return $result;
return $exitCode;
}
}