mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 00:50:18 +01:00 
			
		
		
		
	[Nostromo] Update Status codes
This commit is contained in:
		
							parent
							
								
									643fcfcbda
								
							
						
					
					
						commit
						616258e91e
					
				@ -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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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()));
 | 
			
		||||
 | 
			
		||||
@ -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</>');
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
@ -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');
 | 
			
		||||
 | 
			
		||||
@ -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');
 | 
			
		||||
 | 
			
		||||
@ -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…
	
		Reference in New Issue
	
	Block a user