emyl / vagrant-triggers

Allow the definition of arbitrary scripts that will run on the host before and/or after Vagrant commands.
MIT License
546 stars 35 forks source link

1.6 prevents running vagrant ssh commands #9

Closed coderaaron closed 10 years ago

coderaaron commented 10 years ago

Using the method you recommended here with this in my Vagrantfile

config.trigger.before :halt do
  run "vagrant ssh -c 'vagrant_halt'"
end
config.trigger.before :suspend do
  run "vagrant ssh -c 'vagrant_suspend'"
end
config.trigger.before :destroy do
  run "vagrant ssh -c 'vagrant_destroy'"
end

I get this error when trying to do vagrant halt:

The command "vagrant ssh -c 'db_backup'" returned a failed exit code. The
error output is shown below:

An action 'ssh_run' was attempted on the machine 'default',
but another process is already executing an action on the machine.
Vagrant locks each machine for access by only one process at a time.
Please wait until the other Vagrant process finishes modifying this
machine, then try again.

If you believe this message is in error, please check the process
listing for any "ruby" or "vagrant" processes and kill them. Then
try again.

Looking at the changelog for version 1.6, there is this:

core: Vagrant locks machine access to one Vagrant process at a time. This will protect against two simultaneous up actions happening on the same environment.

For now, I've downgraded to 1.5.4 and it is working again.

emyl commented 10 years ago

Thanks for reporting the issue! :wink:

Let's try to persuade Mitchell to revert this one! https://github.com/mitchellh/vagrant/issues/3693

emyl commented 10 years ago

Will be fixed in 1.6.2:

https://github.com/mitchellh/vagrant/issues/3664