Seravo / wp-vagrant

Vagrant box for the Seravo WordPress project template
https://seravo.com/docs/
MIT License
18 stars 3 forks source link

Stop using vagrant-triggers for Vagrant >= 2.1.0 #49

Closed l3ku closed 4 years ago

l3ku commented 6 years ago

When attempting to run vagrant up on Vagrant version 2.1.0 with vagrant-triggers installed, the command produces a warning and fails as a result of an exception:

$ vagrant up
WARNING: Vagrant has detected the `vagrant-triggers` plugin. This plugin conflicts
with the internal triggers implementation. Please uninstall the `vagrant-triggers`
plugin and run the command again if you wish to use the core trigger feature. To
uninstall the plugin, run the command shown below:

  vagrant plugin uninstall vagrant-triggers

Note that the community plugin `vagrant-triggers` and the core trigger feature
in Vagrant do not have compatible syntax.

To disable this warning, set the environment variable `VAGRANT_USE_VAGRANT_TRIGGERS`.
Bringing machine 'wordpress-box' up with 'virtualbox' provider...
/opt/vagrant/embedded/gems/2.1.0/gems/vagrant-2.1.0/lib/vagrant/plugin/v2/config.rb:73:in `method_missing': undefined method `before_triggers' for #<VagrantPlugins::Triggers::Config::Trigger:0x0000000100baca38> (NoMethodError)
    from /opt/vagrant/embedded/gems/2.1.0/gems/vagrant-2.1.0/lib/vagrant/plugin/v2/trigger.rb:40:in `fire_triggers'
    from /opt/vagrant/embedded/gems/2.1.0/gems/vagrant-2.1.0/lib/vagrant/machine.rb:164:in `action'
    from /opt/vagrant/embedded/gems/2.1.0/gems/vagrant-2.1.0/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

According to https://www.vagrantup.com/docs/triggers/, it seems that Vagrant has its own trigger mechanism which conflicts with the vagrant-triggers plugin. We should probably move away from external plugins and investigate if we could start using Vagrant's own mechanism for newer Vagrant versions, and eventually deprecate the vagrant-triggers plugin.

l3ku commented 6 years ago

Related: should we add a constraint to the Vagrantfile our WordPress layout to restrict usage with version >= 2.1.0 of Vagrant? Currently we require at least version 1.7.4, but there is no upper limit. As a result, if a developer follows the instructions at https://seravo.com/docs/development/how-to-install/ and attempts to run vagrant with our WP layout, he/she will face the error stated above.

Aaronkala commented 6 years ago

Is there any way to bypass this issue? Or should I just downgrade vagrant to an older version (< 2.1.0)?

l3ku commented 6 years ago

Hi! As a temporal workaround, you could try setting the suggested VAGRANT_USE_VAGRANT_TRIGGERS environment variable to disable the warning and see if that works for you. However, I myself have still kept to using an earlier Vagrant version (2.0.2) running on OSX.

ottok commented 6 years ago

The current work-around is to install a Vagrant version older than 2.10. You can find 2.0.4 at https://releases.hashicorp.com/vagrant/2.0.4/

ottok commented 6 years ago

See duplicate of this at https://github.com/Seravo/wordpress/issues/88

ottok commented 6 years ago

This will be fixed as part of a currently on-going refactoring of the whole Vagrant bootstrap process. In the mean time added this note to docs: https://github.com/Seravo/docs/commit/70bb7ec79537237ccbb476d65e22587fe349a5fd

elguitar commented 5 years ago

Vagrant 2.0.4 doesn't support Virtualbox version 6.0 and Virtualbox 6.0 is the packaged version in Ubuntu 19.04 and Fedora 30.

This means that using wp-palvelu-vagrant on new distro releases even more trickery could be needed in order to make it work.

l3ku commented 4 years ago

This was fixed in https://github.com/Seravo/wordpress/commit/a6bf06193af9afb4bb1b662fe1b65d465793e00f. Updating the Vagrantfile to the newest version should fix the trigger-related problems with Vagrant version 2.1.0 or later.