Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Enable/Disable plugins on a per Vagrantfile basis #1574
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.
referenced this issue
May 15, 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:
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)?
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.