Merge pull request #1271 from deployphp/feature-label

Fix bug with parallel deploy to same host
This commit is contained in:
Anton Medvedev 2017-06-21 13:19:10 +07:00 committed by GitHub
commit e7809dc603
3 changed files with 17 additions and 5 deletions

View File

@ -15,6 +15,7 @@
- Fixed parallel execution with non-standart php bin path [#1265] - Fixed parallel execution with non-standart php bin path [#1265]
- Fixed ssh multiplexing initialization [#1268] - Fixed ssh multiplexing initialization [#1268]
- Fixed exit code on error [#1236] - Fixed exit code on error [#1236]
- Fixed bug with deploying in parallel to same host [#1271]
## v5.0.3 ## v5.0.3
[v5.0.2...v5.0.3](https://github.com/deployphp/deployer/compare/v5.0.2...v5.0.3) [v5.0.2...v5.0.3](https://github.com/deployphp/deployer/compare/v5.0.2...v5.0.3)
@ -229,6 +230,7 @@
## v4.0.0 ## v4.0.0
🙄 🙄
[#1271]: https://github.com/deployphp/deployer/pull/1271
[#1268]: https://github.com/deployphp/deployer/pull/1268 [#1268]: https://github.com/deployphp/deployer/pull/1268
[#1265]: https://github.com/deployphp/deployer/pull/1265 [#1265]: https://github.com/deployphp/deployer/pull/1265
[#1263]: https://github.com/deployphp/deployer/pull/1263 [#1263]: https://github.com/deployphp/deployer/pull/1263

View File

@ -17,6 +17,7 @@ class Host
use ConfigurationAccessor; use ConfigurationAccessor;
private $hostname; private $hostname;
private $realHostname;
private $user; private $user;
private $port; private $port;
private $configFile; private $configFile;
@ -31,6 +32,7 @@ class Host
public function __construct(string $hostname) public function __construct(string $hostname)
{ {
$this->hostname = $hostname; $this->hostname = $hostname;
$this->setRealHostname($hostname);
$this->config = new Configuration(); $this->config = new Configuration();
$this->sshArguments = new Arguments(); $this->sshArguments = new Arguments();
} }
@ -62,8 +64,7 @@ class Host
public function __toString() public function __toString()
{ {
$user = empty($this->user) ? '' : "{$this->user}@"; $user = empty($this->user) ? '' : "{$this->user}@";
$hostname = preg_replace('/\/.+$/', '', $this->hostname); return "$user{$this->realHostname}";
return "$user$hostname";
} }
/** /**
@ -80,10 +81,18 @@ class Host
*/ */
public function hostname(string $hostname) public function hostname(string $hostname)
{ {
$this->hostname = $hostname; $this->setRealHostname($hostname);
return $this; return $this;
} }
/**
* @param mixed $hostname
*/
private function setRealHostname(string $hostname)
{
$this->realHostname = preg_replace('/\/.+$/', '', $hostname);
}
/** /**
* @return string * @return string
*/ */

View File

@ -37,8 +37,9 @@ class FileLoaderTest extends TestCase
self::assertEquals('/var/local', $local->get('deploy_to')); self::assertEquals('/var/local', $local->get('deploy_to'));
// bar configured properly // bar configured properly
$bar = $this->getHost('bar.com'); $bar = $this->getHost('bar');
self::assertEquals('bar.com', $bar->getHostname()); self::assertEquals('bar', $bar->getHostname());
self::assertEquals('user@bar.com', "$bar");
self::assertEquals('user', $bar->getUser()); self::assertEquals('user', $bar->getUser());
self::assertEquals(22, $bar->getPort()); self::assertEquals(22, $bar->getPort());
self::assertEquals('configFile', $bar->getConfigFile()); self::assertEquals('configFile', $bar->getConfigFile());