protected function checkReleaseAvailability($releaseToRollback)
    {
        $hosts = $this->runtime->getEnvOption('hosts');
        $hostPath = rtrim($this->runtime->getEnvOption('host_path'), '/');

        $availableInHosts = 0;
        foreach ($hosts as $host) {
            $releases = [];
            $this->runtime->setWorkingHost($host);

            // Get List of Releases
            $cmdListReleases = sprintf('ls -1 %s/releases', $hostPath);

            /** @var Process $process */
            $process = $this->runtime->runRemoteCommand($cmdListReleases, false);
            if ($process->isSuccessful()) {
                $releases = explode(PHP_EOL, trim($process->getOutput()));
                rsort($releases);
            }

            if (in_array($releaseToRollback, $releases)) {
                $availableInHosts++;
            }

            $this->runtime->setWorkingHost(null);
        }

        if ($availableInHosts === count($hosts)) {
            return $releaseToRollback;
        }

        return false;
    }
protected function checkReleaseAvailability($releaseToRollback)
    {
        $hosts = $this->runtime->getEnvOption('hosts');
        $hostPath = rtrim($this->runtime->getEnvOption('host_path'), '/');

        $availableInHosts = 0;
        foreach ($hosts as $host) {
            $releases = [];
            $this->runtime->setWorkingHost($host);

            // Get List of Releases
            $cmdListReleases = sprintf('ls -1 %s/releases', $hostPath);

            /** @var Process $process */
            $process = $this->runtime->runRemoteCommand($cmdListReleases, false);
            if ($process->isSuccessful()) {
                $releases = explode(PHP_EOL, trim($process->getOutput()));
                rsort($releases);
            }

            if (in_array($releaseToRollback, $releases)) {
                $availableInHosts++;
            }

            $this->runtime->setWorkingHost(null);
        }

        if ($availableInHosts === count($hosts)) {
            return $releaseToRollback;
        }

        return false;
    }
protected function checkReleaseAvailability ( $ releaseToRollback ) { $ hosts = $ this -> runtime -> getEnvOption ( 'hosts' ) ; $ hostPath = rtrim ( $ this -> runtime -> getEnvOption ( 'host_path' ) , '/' ) ; $ availableInHosts = 0 ; foreach ( $ hosts as $ host ) { $ releases = [ ] ; $ this -> runtime -> setWorkingHost ( $ host ) ; // Get List of Releases $ cmdListReleases = sprintf ( 'ls -1 %s/releases' , $ hostPath ) ; /** @var Process $process */ $ process = $ this -> runtime -> runRemoteCommand ( $ cmdListReleases , false ) ; if ( $ process -> isSuccessful ( ) ) { $ releases = explode ( PHP_EOL , trim ( $ process -> getOutput ( ) ) ) ; rsort ( $ releases ) ; } if ( in_array ( $ releaseToRollback , $ releases ) ) { $ availableInHosts ++ ; } $ this -> runtime -> setWorkingHost ( null ) ; } if ( $ availableInHosts === count ( $ hosts ) ) { return $ releaseToRollback ; } return false ; }
Check if the provided Release ID is available in all hosts

@param string $releaseToRollback Release ID
@return bool
Check if the provided Release ID is available in all hosts