Browse Source

[Nostromo] Update Status codes

pull/1/head
Andrés Montañez 8 years ago
parent
commit
616258e91e
  1. 10
      src/Mage/Command/BuiltIn/DeployCommand.php
  2. 6
      src/Mage/Command/BuiltIn/Releases/ListCommand.php
  3. 4
      src/Mage/Command/BuiltIn/Releases/RollbackCommand.php
  4. 2
      src/Mage/Runtime/Runtime.php
  5. 2
      src/Mage/Task/BuiltIn/Deploy/TarGz/CleanupTask.php
  6. 2
      src/Mage/Task/BuiltIn/Deploy/TarGz/CopyTask.php
  7. 2
      src/Mage/Task/BuiltIn/Deploy/TarGz/PrepareTask.php

10
src/Mage/Command/BuiltIn/DeployCommand.php

@ -126,7 +126,7 @@ class DeployCommand extends AbstractCommand
}
if (!$this->runTasks($output, $preDeployTasks)) {
throw new DeploymentException(sprintf(' Tasks failed on %s stage, halting deployment', $this->getStageName()), 500);
throw new DeploymentException(sprintf(' Tasks failed on %s stage, halting deployment', $this->getStageName()), 50);
}
// Run On Deploy Tasks
@ -158,7 +158,7 @@ class DeployCommand extends AbstractCommand
foreach ($hosts as $host) {
$this->runtime->setWorkingHost($host);
if (!$this->runTasks($output, $onDeployTasks)) {
throw new DeploymentException(sprintf(' Tasks failed on <fg=black;options=bold>%s</> stage, halting deployment', $this->getStageName()), 500);
throw new DeploymentException(sprintf(' Tasks failed on <fg=black;options=bold>%s</> stage, halting deployment', $this->getStageName()), 50);
}
$this->runtime->setWorkingHost(null);
}
@ -182,7 +182,7 @@ class DeployCommand extends AbstractCommand
foreach ($hosts as $host) {
$this->runtime->setWorkingHost($host);
if (!$this->runTasks($output, $onReleaseTasks)) {
throw new DeploymentException(sprintf(' Tasks failed on <fg=black;options=bold>%s</> stage, halting deployment', $this->getStageName()), 500);
throw new DeploymentException(sprintf(' Tasks failed on <fg=black;options=bold>%s</> stage, halting deployment', $this->getStageName()), 50);
}
$this->runtime->setWorkingHost(null);
}
@ -206,7 +206,7 @@ class DeployCommand extends AbstractCommand
foreach ($hosts as $host) {
$this->runtime->setWorkingHost($host);
if (!$this->runTasks($output, $postReleaseTasks)) {
throw new DeploymentException(sprintf(' Tasks failed on <fg=black;options=bold>%s</> stage, halting deployment', $this->getStageName()), 500);
throw new DeploymentException(sprintf(' Tasks failed on <fg=black;options=bold>%s</> stage, halting deployment', $this->getStageName()), 50);
}
$this->runtime->setWorkingHost(null);
}
@ -228,7 +228,7 @@ class DeployCommand extends AbstractCommand
}
if (!$this->runTasks($output, $postDeployTasks)) {
throw new DeploymentException(sprintf(' Tasks failed on <fg=black;options=bold>%s</> stage, halting deployment', $this->getStageName()), 500);
throw new DeploymentException(sprintf(' Tasks failed on <fg=black;options=bold>%s</> stage, halting deployment', $this->getStageName()), 50);
}
}

6
src/Mage/Command/BuiltIn/Releases/ListCommand.php

@ -61,7 +61,7 @@ class ListCommand extends AbstractCommand
}
if (!$this->runtime->getEnvironmentConfig('releases', false)) {
throw new DeploymentException('Releases are not enabled', 700);
throw new DeploymentException('Releases are not enabled', 70);
}
$output->writeln(sprintf(' Environment: <fg=green>%s</>', $this->runtime->getEnvironment()));
@ -89,7 +89,7 @@ class ListCommand extends AbstractCommand
/** @var Process $process */
$process = $this->runtime->runRemoteCommand($cmdListReleases, false);
if (!$process->isSuccessful()) {
throw new RuntimeException(sprintf('Unable to retrieve releases from host %s', $host), 800);
throw new RuntimeException(sprintf('Unable to retrieve releases from host %s', $host), 80);
}
$releases = explode(PHP_EOL, trim($process->getOutput()));
@ -104,7 +104,7 @@ class ListCommand extends AbstractCommand
/** @var Process $process */
$process = $this->runtime->runRemoteCommand($cmdCurrentRelease, false);
if (!$process->isSuccessful()) {
throw new RuntimeException(sprintf('Unable to retrieve current release from host %s', $host), 850);
throw new RuntimeException(sprintf('Unable to retrieve current release from host %s', $host), 85);
}
$currentReleaseId = explode('/', trim($process->getOutput()));

4
src/Mage/Command/BuiltIn/Releases/RollbackCommand.php

@ -60,7 +60,7 @@ class RollbackCommand extends DeployCommand
}
if (!$this->runtime->getEnvironmentConfig('releases', false)) {
throw new DeploymentException('Releases are not enabled', 700);
throw new DeploymentException('Releases are not enabled', 70);
}
// Check if the Release exists in all hosts
@ -90,7 +90,7 @@ class RollbackCommand extends DeployCommand
return $exception->getCode();
}
} else {
throw new DeploymentException(sprintf('Release %s is not available on all hosts', $releaseToRollback), 720);
throw new DeploymentException(sprintf('Release %s is not available on all hosts', $releaseToRollback), 72);
}
$output->writeln('Finished <fg=blue>Magallanes</>');

2
src/Mage/Runtime/Runtime.php

@ -244,7 +244,7 @@ class Runtime
return $this;
}
throw new InvalidEnvironmentException(sprintf('The environment "%s" does not exists.', $environment), 1000);
throw new InvalidEnvironmentException(sprintf('The environment "%s" does not exists.', $environment), 100);
}
/**

2
src/Mage/Task/BuiltIn/Deploy/TarGz/CleanupTask.php

@ -34,7 +34,7 @@ class CleanupTask extends AbstractTask
public function execute()
{
if (!$this->runtime->getEnvironmentConfig('releases', false)) {
throw new ErrorException('This task is only available with releases enabled', 400);
throw new ErrorException('This task is only available with releases enabled', 40);
}
$tarGzLocal = $this->runtime->getVar('targz_local');

2
src/Mage/Task/BuiltIn/Deploy/TarGz/CopyTask.php

@ -34,7 +34,7 @@ class CopyTask extends AbstractTask
public function execute()
{
if (!$this->runtime->getEnvironmentConfig('releases', false)) {
throw new DeploymentException('This task is only available with releases enabled', 400);
throw new DeploymentException('This task is only available with releases enabled', 40);
}
$user = $this->runtime->getEnvironmentConfig('user');

2
src/Mage/Task/BuiltIn/Deploy/TarGz/PrepareTask.php

@ -34,7 +34,7 @@ class PrepareTask extends AbstractTask
public function execute()
{
if (!$this->runtime->getEnvironmentConfig('releases', false)) {
throw new DeploymentException('This task is only available with releases enabled', 400);
throw new DeploymentException('This task is only available with releases enabled', 40);
}
$tarGzLocal = $this->runtime->getTempFile();

Loading…
Cancel
Save