New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable/Disable plugins on a per Vagrantfile basis #1574

Closed
reset opened this Issue Apr 10, 2013 · 17 comments

Comments

Projects
None yet
@reset
Contributor

reset commented Apr 10, 2013

Some plugins may not fit for every project that is leveraging Vagrant. As is, all plugins which are installed are loaded when Vagrant starts. It would be awesome if a plugin author had the option to lazily load their plugins and require users to manually require these plugins in their Vagrantfile.

A good example plugin which may not need to be loaded for every project is Berkshelf-Vagrant. We're currently taking steps to add our own 'enable' configuration flag which will cause the middleware to do a no-op.

@bflad

This comment has been minimized.

Show comment
Hide comment
@bflad

bflad May 16, 2013

Sort of relates to #1700 as well if implemented correctly.

I could envision the Vagrantfile then accepting something like:

Vagrant.configure("2") do |config|
  # simple load
  config.plugin 'vagrant-berkshelf'
  # maybe more advanced logic
  config.plugin 'vagrant-berkshelf' do |plugin|
    plugin.version '>1.2.0'
  end
  #...
end

Where it could install the plugin automatically if it's not available and fix your lazy loading issue.

For reference, here's the offending code when a Vagrant environment is spinning up that loads all external plugins:
https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/environment.rb#L132
https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/environment.rb#L742-L776

Maybe the load_plugins function should be unprotected or moved closer to the Vagrant kernel and optionally take an array of plugins to load (nil loading all)?

bflad commented May 16, 2013

Sort of relates to #1700 as well if implemented correctly.

I could envision the Vagrantfile then accepting something like:

Vagrant.configure("2") do |config|
  # simple load
  config.plugin 'vagrant-berkshelf'
  # maybe more advanced logic
  config.plugin 'vagrant-berkshelf' do |plugin|
    plugin.version '>1.2.0'
  end
  #...
end

Where it could install the plugin automatically if it's not available and fix your lazy loading issue.

For reference, here's the offending code when a Vagrant environment is spinning up that loads all external plugins:
https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/environment.rb#L132
https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/environment.rb#L742-L776

Maybe the load_plugins function should be unprotected or moved closer to the Vagrant kernel and optionally take an array of plugins to load (nil loading all)?

@fgrehm

This comment has been minimized.

Show comment
Hide comment
@fgrehm

fgrehm Jul 15, 2013

Collaborator

Hey guys, here's my take on the problem: https://github.com/fgrehm/vundler :)

Collaborator

fgrehm commented Jul 15, 2013

Hey guys, here's my take on the problem: https://github.com/fgrehm/vundler :)

@mitchellh

This comment has been minimized.

Show comment
Hide comment
@mitchellh

mitchellh Jul 17, 2013

Member

I think for now delegating this out to Vundler is ideal. Closing.

Member

mitchellh commented Jul 17, 2013

I think for now delegating this out to Vundler is ideal. Closing.

@mitchellh mitchellh closed this Jul 17, 2013

@erunion

This comment has been minimized.

Show comment
Hide comment
@erunion

erunion Aug 23, 2013

Why not move it into core instead of having to have everyone use a plugin to manage plugins?

erunion commented Aug 23, 2013

Why not move it into core instead of having to have everyone use a plugin to manage plugins?

@leifmadsen

This comment has been minimized.

Show comment
Hide comment
@leifmadsen

leifmadsen Aug 23, 2013

Yo dawg, I heard you like plugins, so we let you manage your plugins with a plugin.

leifmadsen commented Aug 23, 2013

Yo dawg, I heard you like plugins, so we let you manage your plugins with a plugin.

@mitchellh

This comment has been minimized.

Show comment
Hide comment
@mitchellh

mitchellh Aug 23, 2013

Member

The goal is to eventually move this into core, but this provides a good stand-in.

Member

mitchellh commented Aug 23, 2013

The goal is to eventually move this into core, but this provides a good stand-in.

@nikolay

This comment has been minimized.

Show comment
Hide comment
@nikolay

nikolay Aug 23, 2013

👍 This definitely should be part of the core and I hope to see it there soon!

nikolay commented Aug 23, 2013

👍 This definitely should be part of the core and I hope to see it there soon!

@nikolay

This comment has been minimized.

Show comment
Hide comment
@nikolay

nikolay Aug 23, 2013

I though like the approach of specifying dependency plugins in https://github.com/tknerr/vagrant-plugin-bundler better than with Binder as the vast majority of projects won't have too many plugins and having a separate file is a bit of a overkill. You can with the approach of vagrant-plugin-bundler, you can parse an external file in .json, .yml, or any other format easily (if you really need it). What if those dependencies are determined at runtime, etc.

nikolay commented Aug 23, 2013

I though like the approach of specifying dependency plugins in https://github.com/tknerr/vagrant-plugin-bundler better than with Binder as the vast majority of projects won't have too many plugins and having a separate file is a bit of a overkill. You can with the approach of vagrant-plugin-bundler, you can parse an external file in .json, .yml, or any other format easily (if you really need it). What if those dependencies are determined at runtime, etc.

@erunion

This comment has been minimized.

Show comment
Hide comment
@erunion

erunion commented Aug 24, 2013

@mitchellh Awesome.

@gregelin

This comment has been minimized.

Show comment
Hide comment
@gregelin

gregelin Oct 4, 2013

Please, please include this in the core. Typing vagrant up is magic. Having to separately install anything diminishes the magic.

gregelin commented Oct 4, 2013

Please, please include this in the core. Typing vagrant up is magic. Having to separately install anything diminishes the magic.

@imduffy15

This comment has been minimized.

Show comment
Hide comment
@imduffy15

imduffy15 Jun 14, 2014

Why is this closed? vagrant-plugin-bundler and Vundler are both unmaintained leaving this unsolved.

imduffy15 commented Jun 14, 2014

Why is this closed? vagrant-plugin-bundler and Vundler are both unmaintained leaving this unsolved.

@dasgoll

This comment has been minimized.

Show comment
Hide comment
@dasgoll

dasgoll Apr 12, 2015

Shouldn't this fucntionality be in core??

dasgoll commented Apr 12, 2015

Shouldn't this fucntionality be in core??

@jhoblitt

This comment has been minimized.

Show comment
Hide comment
@jhoblitt

jhoblitt May 12, 2015

I'm running into vagrant-librarian-puppet being incompatible with puppet-aws when its parallelizing. It would be great to not have to uninstall a plugin to disable it...

jhoblitt commented May 12, 2015

I'm running into vagrant-librarian-puppet being incompatible with puppet-aws when its parallelizing. It would be great to not have to uninstall a plugin to disable it...

@amosshapira

This comment has been minimized.

Show comment
Hide comment
@amosshapira

amosshapira Mar 7, 2016

Same situation as @jhoblitt - I use vagrant-vbguest which only supports Linux, so it breaks my OSX Vagrant boxes...

amosshapira commented Mar 7, 2016

Same situation as @jhoblitt - I use vagrant-vbguest which only supports Linux, so it breaks my OSX Vagrant boxes...

@chillum

This comment has been minimized.

Show comment
Hide comment
@chillum

chillum Aug 30, 2016

Same situation as @amontalban, vargrant-vbguest works with Linux, but breaks FreeBSD.

chillum commented Aug 30, 2016

Same situation as @amontalban, vargrant-vbguest works with Linux, but breaks FreeBSD.

@varac

This comment has been minimized.

Show comment
Hide comment
@varac

varac Jan 31, 2017

I love vagrant-sshfs which works great for vagrant-libvirt but breaks with vagrant-lxc :(
So @mitchellh please consider this functionality in vagrant-core, because the the workaround you proposed isn't valid anymore now that vundler is not maintained anymore.

varac commented Jan 31, 2017

I love vagrant-sshfs which works great for vagrant-libvirt but breaks with vagrant-lxc :(
So @mitchellh please consider this functionality in vagrant-core, because the the workaround you proposed isn't valid anymore now that vundler is not maintained anymore.

@robinbowes

This comment has been minimized.

Show comment
Hide comment
@robinbowes

robinbowes Feb 20, 2017

Really? Is there no native way to disable plugins on a per-environment basis?

robinbowes commented Feb 20, 2017

Really? Is there no native way to disable plugins on a per-environment basis?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment