mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 00:50:18 +01:00 
			
		
		
		
	Merge pull request #208 from KillerDiller/develop
don’t fail the initial deployment to a target, and allow ssh without a username
This commit is contained in:
		
						commit
						f605692817
					
				@ -202,7 +202,8 @@ abstract class AbstractTask
 | 
				
			|||||||
        $localCommand = 'ssh ' . $this->getConfig()->getHostIdentityFileOption() . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
 | 
					        $localCommand = 'ssh ' . $this->getConfig()->getHostIdentityFileOption() . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
 | 
				
			||||||
            . '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
 | 
					            . '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
 | 
				
			||||||
            . $this->getConfig()->getConnectTimeoutOption()
 | 
					            . $this->getConfig()->getConnectTimeoutOption()
 | 
				
			||||||
            . $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName();
 | 
					            . ( $this->getConfig()->deployment('user') != '' ? $this->getConfig()->deployment('user') . '@' : '' )
 | 
				
			||||||
 | 
					            . $this->getConfig()->getHostName();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $remoteCommand = str_replace('"', '\"', $command);
 | 
					        $remoteCommand = str_replace('"', '\"', $command);
 | 
				
			||||||
        if ($cdToDirectoryFirst) {
 | 
					        if ($cdToDirectoryFirst) {
 | 
				
			||||||
 | 
				
			|||||||
@ -78,18 +78,19 @@ class ReleaseTask extends AbstractTask implements IsReleaseAware, SkipOnOverride
 | 
				
			|||||||
                $command = 'chown -R ' . $userGroup . ' ' . $currentCopy
 | 
					                $command = 'chown -R ' . $userGroup . ' ' . $currentCopy
 | 
				
			||||||
                    . ' && '
 | 
					                    . ' && '
 | 
				
			||||||
                    . 'chown ' . $userGroup . ' ' . $releasesDirectory;
 | 
					                    . 'chown ' . $userGroup . ' ' . $releasesDirectory;
 | 
				
			||||||
                if (file_exists($symlink)) {
 | 
					 | 
				
			||||||
                    $command.= ' && ' . 'chown -h ' . $userGroup . ' ' . $symlink;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                $result = $this->runCommandRemote($command);
 | 
					                $result = $this->runCommandRemote($command);
 | 
				
			||||||
                if (!$result) {
 | 
					                if (!$result) {
 | 
				
			||||||
                    return $result;
 | 
					                    return $result;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Remove symlink if exists; create new symlink and change owner
 | 
					            // Switch symlink and change owner
 | 
				
			||||||
            $tmplink = $currentCopy . '.tmp';
 | 
					            $tmplink = $symlink . '.tmp';
 | 
				
			||||||
            $command = "ln -sfn {$currentCopy} {$tmplink} && mv -fT {$tmplink} {$symlink}";
 | 
					            $command = "ln -sfn {$currentCopy} {$tmplink}";
 | 
				
			||||||
 | 
					            if ($resultFetch && $userGroup != '') {
 | 
				
			||||||
 | 
					                $command.= " && chown -h {$userGroup} {$tmplink}";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            $command.= " && mv -fT {$tmplink} {$symlink}";
 | 
				
			||||||
            $result = $this->runCommandRemote($command);
 | 
					            $result = $this->runCommandRemote($command);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($result) {
 | 
					            if ($result) {
 | 
				
			||||||
 | 
				
			|||||||
@ -100,7 +100,9 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
 | 
				
			|||||||
                 . $this->excludes($excludes) . ' '
 | 
					                 . $this->excludes($excludes) . ' '
 | 
				
			||||||
                 . $this->excludesListFile($excludesListFilePath) . ' '
 | 
					                 . $this->excludesListFile($excludesListFilePath) . ' '
 | 
				
			||||||
                 . $this->getConfig()->deployment('from') . ' '
 | 
					                 . $this->getConfig()->deployment('from') . ' '
 | 
				
			||||||
                 . $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
 | 
					                 . ( $this->getConfig()->deployment('user') ? $this->getConfig()->deployment('user') . '@' : '' )
 | 
				
			||||||
 | 
					                 . $this->getConfig()->getHostName() . ':' . $deployToDirectory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $result = $this->runCommandLocal($command);
 | 
					        $result = $this->runCommandLocal($command);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $result;
 | 
					        return $result;
 | 
				
			||||||
 | 
				
			|||||||
@ -138,14 +138,12 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
 | 
				
			|||||||
                    $userGroup = '';
 | 
					                    $userGroup = '';
 | 
				
			||||||
                    $resultFetch = $this->runCommandRemote('ls -ld ' . $rollbackTo . ' | awk \'{print \$3":"\$4}\'', $userGroup);
 | 
					                    $resultFetch = $this->runCommandRemote('ls -ld ' . $rollbackTo . ' | awk \'{print \$3":"\$4}\'', $userGroup);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    $tmplink = $rollbackTo . '.tmp';
 | 
					                    $tmplink = $symlink . '.tmp';
 | 
				
			||||||
                    $command = 'ln -sfn ' . $currentCopy . ' ' . $tmplink
 | 
					                    $command = "ln -sfn {$currentCopy} {$tmplink}";
 | 
				
			||||||
                             . ' && '
 | 
					                    if ($resultFetch && $userGroup) {
 | 
				
			||||||
                             . 'mv -T ' . $tmplink . ' ' . $symlink;
 | 
					                        $command .= " && chown -h {$userGroup} ${tmplink}";
 | 
				
			||||||
 | 
					 | 
				
			||||||
                    if ($resultFetch) {
 | 
					 | 
				
			||||||
                        $command .= ' && chown -h ' . $userGroup . ' ' . $symlink;
 | 
					 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					                    $command .= " && mv -T {$tmplink} {$symlink}";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    $result = $this->runCommandRemote($command);
 | 
					                    $result = $this->runCommandRemote($command);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user