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

trigger / provisioning order #14

Closed auth00 closed 10 years ago

auth00 commented 10 years ago

Is the intention for initial ":up" and ":provision" after scripts to run before the provisioning takes place? On my intended Vagrantfile and on the simplest Vagrantfile possible this order makes it impossible to let ":shell" provisioning happen before the after script.

virtualbox 4.3.12 vagrant 1.6.2 vagrant-triggers 0.4.0

My Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.box_url = "http://files.vagrantup.com/precise64.box"

config.vm.provision :shell do |shell| shell.path = "provision.sh" end

config.trigger.before :up, :stdout => true do print "Before up!\n" end

config.trigger.after :up, :stdout => true do print "After up!\n" end

config.trigger.after :provision, :stdout => true do print "After provision!\n" end

end

emyl commented 10 years ago

Tagged as bug

corbt commented 10 years ago

It would also be good for triggers to run after shared folders are mounted.

joergRossdeutscher commented 10 years ago

I have some code in my Vagrantfile to opens the default browser with a URL pointing to the VMs apache. This doesn't work anymore for me after updating vagrant from 1.5.3 to 1.6.3 yesterday:

  sR_autoOpenUrl            = "http://for.bar.baz"
  if sR_autoOpenUrl != ""
    config.trigger.after [:up] do
      system("open", sR_autoOpenUrl)
    end
  end

Sinve my vagrant update the system call runs to early. The URL itself is working, but apache cannot deliver since nfs mounting has not happenend yet and there is no website.

Is this bug responsible for that behaviour? I am in doubt, since (I believe, at least…) I updated vagrant, not this plugin.

emyl commented 10 years ago

@joergRossdeutscher please test your Vagrantfile with the version 0.4.1 of the plugin and, if you're still affected from the bug, feel free to open a new issue :wink:

joergRossdeutscher commented 10 years ago

Thanks for your good work, my workflow is restored. ;-)