Manually Installing Plugins in Vagrant

It looks like there have been some changes lately in Vagrant from v 1.7.4 –> 1.8.4 that allow me to no longer install plugins locally.

I kept getting failures that looked like this:

vagrant plugin install ./vagrant-libvirt-0.0.33.gem 
Installing the './vagrant-libvirt-0.0.33.gem' plugin. This can take a few minutes...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

Could not find gem 'vagrant-libvirt (= 0.0.33)' in any of the gem sources listed in your Gemfile or available on this machine.

Warning: this Gemfile contains multiple primary sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. To upgrade this warning to an error, run `bundle config disable_multisource true`.Warning: this Gemfile contains multiple primary sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. To upgrade this warning to an error, run `bundle config disable_multisource true`.

So based on my read of https://github.com/mitchellh/vagrant/issues/5643 there is a work around to host a local gem server to make the install proceed that way and sure enough it works. Here are the steps for that workaround as it pertains to the vagrant-libvirt plugin for Vagrant.

sudo apt-get install ruby-dev zlib1g-dev

#Download and build the Vagrant-libvirt plugin
git clone https://github.com/vagrant-libvirt/vagrant-libvirt.git
cd vagrant-libvirt/
gem build vagrant-libvirt.gemspec

#workaround for Local Gem Install Failure
#https://github.com/mitchellh/vagrant/issues/5643

#Install it locally
sudo gem install ./vagrant-libvirt*.gem

#Serve the locally installed gems on localhost:8808
sudo gem server & 

#Install the vagrant plugin while pointing at a local gemserver
vagrant plugin install vagrant-libvirt --plugin-source http://localhost:8808

# Turn off the gem server
kill %1
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s