From c2eab78db08985ed929b5df34813c3bbdf759284 Mon Sep 17 00:00:00 2001 From: Alexandru Szasz Date: Sat, 6 Apr 2019 22:50:35 +0300 Subject: [PATCH 1/2] Add vagrant transport to Drush. This allows executing drush calls via vagrant ssh -c by just using vagrant: in the site alias file. Support for this was added in site-process here: https://github.com/consolidation/site-process/pull/40 --- src/Runtime/DependencyInjection.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Runtime/DependencyInjection.php b/src/Runtime/DependencyInjection.php index cfcff42032..540fff3937 100644 --- a/src/Runtime/DependencyInjection.php +++ b/src/Runtime/DependencyInjection.php @@ -15,6 +15,7 @@ use Drush\Command\DrushCommandInfoAlterer; use Consolidation\Config\Util\ConfigOverlay; use Drush\Config\DrushConfig; +use Drush\SiteAlias\ProcessManager; /** * Prepare our Dependency Injection Container @@ -111,11 +112,13 @@ protected function addDrushServices(ContainerInterface $container, ClassLoader $ $container->share('tildeExpansion.hook', 'Drush\Runtime\TildeExpansionHook'); $container->share('ssh.transport', \Consolidation\SiteProcess\Factory\SshTransportFactory::class); $container->share('docker-compose.transport', \Consolidation\SiteProcess\Factory\DockerComposeTransportFactory::class); - $container->share('process.manager', 'Drush\SiteAlias\ProcessManager') + $container->share('vagrant.transport', \Consolidation\SiteProcess\Factory\VagrantTransportFactory::class); + $container->share('process.manager', ProcessManager::class) ->withMethodCall('setConfig', ['config']) ->withMethodCall('setConfigRuntime', ['config.runtime']) ->withMethodCall('add', ['ssh.transport']) - ->withMethodCall('add', ['docker-compose.transport']); + ->withMethodCall('add', ['docker-compose.transport']) + ->withMethodCall('add', ['vagrant.transport']); $container->share('redispatch.hook', 'Drush\Runtime\RedispatchHook') ->withArgument('process.manager'); From e4e511ed87b557bf7648f20b145bbaf82efddc75 Mon Sep 17 00:00:00 2001 From: Alexandru Szasz Date: Sun, 7 Apr 2019 15:06:33 +0300 Subject: [PATCH 2/2] add all the transports available instead of selectively --- src/Runtime/DependencyInjection.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Runtime/DependencyInjection.php b/src/Runtime/DependencyInjection.php index 540fff3937..4c46d99cbb 100644 --- a/src/Runtime/DependencyInjection.php +++ b/src/Runtime/DependencyInjection.php @@ -110,15 +110,9 @@ protected function addDrushServices(ContainerInterface $container, ClassLoader $ $container->share('bootstrap.hook', 'Drush\Boot\BootstrapHook') ->withArgument('bootstrap.manager'); $container->share('tildeExpansion.hook', 'Drush\Runtime\TildeExpansionHook'); - $container->share('ssh.transport', \Consolidation\SiteProcess\Factory\SshTransportFactory::class); - $container->share('docker-compose.transport', \Consolidation\SiteProcess\Factory\DockerComposeTransportFactory::class); - $container->share('vagrant.transport', \Consolidation\SiteProcess\Factory\VagrantTransportFactory::class); $container->share('process.manager', ProcessManager::class) ->withMethodCall('setConfig', ['config']) - ->withMethodCall('setConfigRuntime', ['config.runtime']) - ->withMethodCall('add', ['ssh.transport']) - ->withMethodCall('add', ['docker-compose.transport']) - ->withMethodCall('add', ['vagrant.transport']); + ->withMethodCall('setConfigRuntime', ['config.runtime']); $container->share('redispatch.hook', 'Drush\Runtime\RedispatchHook') ->withArgument('process.manager'); @@ -165,6 +159,8 @@ protected function alterServicesForDrush(ContainerInterface $container, Applicat $commandProcessor = $container->get('commandProcessor'); $commandProcessor->setPassExceptions(true); + + ProcessManager::addTransports($container->get('process.manager')); } protected function injectApplicationServices(ContainerInterface $container, Application $application)