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

Current working directory of triggered script is not the location of the Vagrantfile #44

Closed jfly closed 9 years ago

jfly commented 9 years ago

Vagrant allows you to run "vagrant ..." from any directory, and it will search upwards to find the nearest Vagrantfile. I've written my trigger scripts assuming that the current working directory is the same directory as my Vagrantfile, but that appears to not be the case. Here's my workaround:

  config.trigger.before [:reload, :up, :provision], stdout: true do
    Dir.chdir '..' while !File.exist?('Vagrantfile')
    ...
  end
emyl commented 9 years ago

Hi!

Marked as :bug:

Going to fix in the next release! Thanks!