This repository has been archived by the owner. It is now read-only.

Add config to auto-install plugins on `vagrant up` #19

Closed
patcon opened this Issue Aug 27, 2013 · 9 comments

Comments

Projects
None yet
4 participants
@patcon
Collaborator

patcon commented Aug 27, 2013

Not sure whether this is a good idea... Basically thinking it might make sense to reproduce the experience of vagrant-librarian-chef where it will update/install cookbooks when you run vagrant up.

Would it be sensible to create an option in the vagrantfile to automatically run vagrant plugin bundle on vagrant up?

@erran

This comment has been minimized.

Show comment
Hide comment
@erran

erran Sep 14, 2013

Collaborator

@patcon, in regards to proviso#16, I can see where you're coming from w/ the auto installation of plugins. It's a feature I personally wanted at first and would still love to see. I'll try to come up with a nice way to handle it

Perhaps the approach that was taken by .rvmrc files, i.e. alerting users when a .rvmrc file will change the environment, in our case when plugins will be installed automatically.

What do you think @fgrehm?

I can also picture creating an auxiliary method to be used at the top of Vagrant files:

# Automatically install plugins given that bindler is installed:
if Vagrant.has_plugin? 'bindler'
  Bindler.setup :auto_install => true
end

# This is a safe alternative to the above if we don't end up prompting the user by default:
if Vagrant.has_plugin? 'bindler'
  Bindler.setup :auto_install => :prompt_user
end

# Prints to stderr and exits w/ a status of 1 and lists the unmet dependencies:
if Vagrant.has_plugin? 'bindler'
  Bindler.setup :failure_action => :exit
end
Collaborator

erran commented Sep 14, 2013

@patcon, in regards to proviso#16, I can see where you're coming from w/ the auto installation of plugins. It's a feature I personally wanted at first and would still love to see. I'll try to come up with a nice way to handle it

Perhaps the approach that was taken by .rvmrc files, i.e. alerting users when a .rvmrc file will change the environment, in our case when plugins will be installed automatically.

What do you think @fgrehm?

I can also picture creating an auxiliary method to be used at the top of Vagrant files:

# Automatically install plugins given that bindler is installed:
if Vagrant.has_plugin? 'bindler'
  Bindler.setup :auto_install => true
end

# This is a safe alternative to the above if we don't end up prompting the user by default:
if Vagrant.has_plugin? 'bindler'
  Bindler.setup :auto_install => :prompt_user
end

# Prints to stderr and exits w/ a status of 1 and lists the unmet dependencies:
if Vagrant.has_plugin? 'bindler'
  Bindler.setup :failure_action => :exit
end
@erran

This comment has been minimized.

Show comment
Hide comment
@erran

erran Sep 14, 2013

Collaborator

I'd like the Bindler.setup approach. We could also add plugins that aren't in the plugins manifest. It'd be useful if an issue such as platform dependent plugins occurred. By allowing developers to add values (strings/hashes) to the plugins array we keep.

if Vagrant.has_plugin? 'bindler'
  # NOTE: vagrant-foo isn't compatible w/ Windows so this plugin monkey patches it to work.
  Bindler.plugins << { 'vagrant-foo-windows' => '1.2.3'}

  unless Bindler.plugins.include?('vagrant-bar')
    Bindler.plugins << 'vagrant-bar'
  end
end
Collaborator

erran commented Sep 14, 2013

I'd like the Bindler.setup approach. We could also add plugins that aren't in the plugins manifest. It'd be useful if an issue such as platform dependent plugins occurred. By allowing developers to add values (strings/hashes) to the plugins array we keep.

if Vagrant.has_plugin? 'bindler'
  # NOTE: vagrant-foo isn't compatible w/ Windows so this plugin monkey patches it to work.
  Bindler.plugins << { 'vagrant-foo-windows' => '1.2.3'}

  unless Bindler.plugins.include?('vagrant-bar')
    Bindler.plugins << 'vagrant-bar'
  end
end
@patcon

This comment has been minimized.

Show comment
Hide comment
@patcon

patcon Sep 14, 2013

Collaborator

Really like the Bindler.setup idea! (And thanks for the heads up about Vagrant.has_plugin?)

As for managing the plugin manifest from the Vagrantfile, not sure if this is the best approach in the long-term, but it will be helpful until we ditch the json file :) (Hooray for a future ruby Pluginfile via librarian!)

EDIT: As for auto-installing gems/plugins, I'm kinda on the fence. I was originally drawing comparisons to vagrant-librarian-chef auto-installing cookbooks, but someone else could say that cookbooks are executed on the VM, whereas gems are on the workstation. But having said that, vagrant can share tons of important directories with the VM, so perhaps the distinction is false. Maybe the real answer is that you should generally assume your system can be totally effed up by running vagrant up on an untrusted project, so who cares if we auto-install plugins. Avoiding the auto-installation of bindler plugins (or even prompting) might just as well be "security theater" or perhaps "due diligence theater" :)

Collaborator

patcon commented Sep 14, 2013

Really like the Bindler.setup idea! (And thanks for the heads up about Vagrant.has_plugin?)

As for managing the plugin manifest from the Vagrantfile, not sure if this is the best approach in the long-term, but it will be helpful until we ditch the json file :) (Hooray for a future ruby Pluginfile via librarian!)

EDIT: As for auto-installing gems/plugins, I'm kinda on the fence. I was originally drawing comparisons to vagrant-librarian-chef auto-installing cookbooks, but someone else could say that cookbooks are executed on the VM, whereas gems are on the workstation. But having said that, vagrant can share tons of important directories with the VM, so perhaps the distinction is false. Maybe the real answer is that you should generally assume your system can be totally effed up by running vagrant up on an untrusted project, so who cares if we auto-install plugins. Avoiding the auto-installation of bindler plugins (or even prompting) might just as well be "security theater" or perhaps "due diligence theater" :)

@fgrehm

This comment has been minimized.

Show comment
Hide comment
@fgrehm

fgrehm Sep 14, 2013

Owner

@patcon @ipwnstuff tks a lot for sharing your thoughts and for trying to push things forward :)

I personally like the idea of auto installing things but I haven't given much thought on how this should work. TBH I still don't have a strong need for using Bindler yet and since you two are the ones who seem to care the most, I'll say it's up to you guys to decide how this should work and behave. We haven't reached 1.0 yet, so go ahead and experiment with ideas while we can break things and feel free to implement whatever makes sense to you. I'm sure you'll come up with nice stuff :)

I've been missing in action on this project for a while so I'll add @patcon as a collaborator and you guys can continue to push the project forward.

Owner

fgrehm commented Sep 14, 2013

@patcon @ipwnstuff tks a lot for sharing your thoughts and for trying to push things forward :)

I personally like the idea of auto installing things but I haven't given much thought on how this should work. TBH I still don't have a strong need for using Bindler yet and since you two are the ones who seem to care the most, I'll say it's up to you guys to decide how this should work and behave. We haven't reached 1.0 yet, so go ahead and experiment with ideas while we can break things and feel free to implement whatever makes sense to you. I'm sure you'll come up with nice stuff :)

I've been missing in action on this project for a while so I'll add @patcon as a collaborator and you guys can continue to push the project forward.

@patcon

This comment has been minimized.

Show comment
Hide comment
@patcon

patcon Sep 14, 2013

Collaborator

Thanks! 👍

Collaborator

patcon commented Sep 14, 2013

Thanks! 👍

@erran

This comment has been minimized.

Show comment
Hide comment
@erran

erran Sep 14, 2013

Collaborator

Sounds good. I haven't been using my privileges as a collab much until I looked over the project and a few issues today. At work it's possibly that I'll be using Vagrant again soon (it got pushed back a month/two ago when I joined full time as a test dev vs. a intern). I'd like to start doing projects using Vagrant soon though, so I may be come a contributor again by night.

Collaborator

erran commented Sep 14, 2013

Sounds good. I haven't been using my privileges as a collab much until I looked over the project and a few issues today. At work it's possibly that I'll be using Vagrant again soon (it got pushed back a month/two ago when I joined full time as a test dev vs. a intern). I'd like to start doing projects using Vagrant soon though, so I may be come a contributor again by night.

@nitinmohan87

This comment has been minimized.

Show comment
Hide comment
@nitinmohan87

nitinmohan87 Oct 17, 2013

Hello all.. Any progress on this issue? I am facing a similar problem with kitchen-vagrant (test-kitchen/kitchen-vagrant#44) where it autocreates a Vagrantfile to run Vagrant in a sandboxed environment. It doesn't have the capability yet to install vagrant plugins inside the sandbox. The discussion on this thread sounds like a great thing to have.

nitinmohan87 commented Oct 17, 2013

Hello all.. Any progress on this issue? I am facing a similar problem with kitchen-vagrant (test-kitchen/kitchen-vagrant#44) where it autocreates a Vagrantfile to run Vagrant in a sandboxed environment. It doesn't have the capability yet to install vagrant plugins inside the sandbox. The discussion on this thread sounds like a great thing to have.

@erran

This comment has been minimized.

Show comment
Hide comment
@erran

erran Oct 18, 2013

Collaborator

@nitinmohan87 I posted a decent temporary work around here. I'll update this comment with the link to it soon. The proper work around can be added to ipwnstuff/librarian-vagrant which is a project that I started up to tie into bindler and never got around to finishing. @patcon has actually contributed to it and I'd be glad to pull in any code you add. I'm just now starting to use chef again, hopefully I can spend some time on this at work.

Collaborator

erran commented Oct 18, 2013

@nitinmohan87 I posted a decent temporary work around here. I'll update this comment with the link to it soon. The proper work around can be added to ipwnstuff/librarian-vagrant which is a project that I started up to tie into bindler and never got around to finishing. @patcon has actually contributed to it and I'd be glad to pull in any code you add. I'm just now starting to use chef again, hopefully I can spend some time on this at work.

@fgrehm

This comment has been minimized.

Show comment
Hide comment
@fgrehm

fgrehm May 11, 2014

Owner

The project is no longer being maintained, let's keep the issue tracker just for eventual bugs people might find.

Owner

fgrehm commented May 11, 2014

The project is no longer being maintained, let's keep the issue tracker just for eventual bugs people might find.

@fgrehm fgrehm closed this May 11, 2014

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