Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Add default directory for vagrant exec commands. #1435

Closed
wants to merge 1 commit into from

Conversation

grasmash
Copy link

@grasmash grasmash commented Jun 19, 2017

This PR adds support for the Vagrant Exec plugin.

By default, using vagrant exec [command] will execute a command in the /vagrant dir on the VM. This can be problematic for a variety of reasons.

In short, /vagrant isn't the directory that is considered the "drupal" directory. We should use drupal_composer_install_dir instead.

This PR will not affect users that do not use Vagrant Exec.

@geerlingguy
Copy link
Owner

See issue: #1432

@@ -152,6 +152,10 @@ Vagrant.configure('2') do |config|
type: vconfig['vagrant_synced_folder_default_type']
}
end

if Vagrant.has_plugin?('vagrant-exec')
config.exec.commands '*', directory: vconfig['drupal_composer_install_dir']
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would definitely serve the use case of sites that are managed using the BLT directory structure, or the default for Drupal VM out of the box.

However... if you have a site where you're just sharing the codebase into the VM, and you set that path directly in config.yml, the path would likely not be drupal_composer_install_dir, and it might not be immediately obvious to the end user why vagrant exec isn't working correctly.

In this case, I think that it might make more sense to just mention this configuration in the docs (see: http://docs.drupalvm.com/en/latest/extras/drupal-console/#remote-command-execution-using-vagrant-exec), and then let end users (or something like BLT) add the explicit path to the Vagrantfile.local directly.

I can't think of a way (at least not a simple way) to support the flexibility we currently do (composer project or not, any kind of directory structure, possibility of using Drupal VM with things other than Drupal which would have an entirely different structure, etc.) while forcing the exec root directory to any of the default vars in the Drupal VM config...

@geerlingguy
Copy link
Owner

@grasmash - Were you able to implement this within BLT?

@geerlingguy
Copy link
Owner

Closing as it looks like it was implemented downstream.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants