Chef Solo + URL to Cheffile

391 views
Skip to first unread message

lukewpatterson

unread,
May 25, 2012, 6:55:03 PM5/25/12
to vagra...@googlegroups.com
This is what I want:

I want Librarian to download and assemble my cookbook repo, using a URL in my Vagrantfile which points to my Cheffile

Ideas?

Other must-haves:
  • user must not be required to download/check-out more than one file, i.e. they just need the Vagrantfile, and to run "vagrant up"
  • user must not be required to run "vagrant gem install librarian", i.e. user must not be required to manually install the librarian gem, although it is acceptable for the Vagrantfile to programmatically install - so far I haven't had luck with programmatic gem installation
  • must be able to use "standard" base boxes, e.g. don't need to install librarian gem inside base box before distribution

Thanks,
Luke

Mike

unread,
May 25, 2012, 7:33:53 PM5/25/12
to vagra...@googlegroups.com
Seems ripe for a plugin to vagrant. http://vagrantup.com/docs/plugins.html
So instead of `vagrant up`, it might be `vagrant assemble` or
something of that ilk, that ends with a `vagrant up`-like action after
all the other parts are met.

lukewpatterson

unread,
May 25, 2012, 8:13:08 PM5/25/12
to vagra...@googlegroups.com
On Friday, May 25, 2012 6:33:53 PM UTC-5, miketheman wrote:
Seems ripe for a plugin to vagrant. http://vagrantup.com/docs/plugins.html
So instead of `vagrant up`, it might be `vagrant assemble` or
something of that ilk, that ends with a `vagrant up`-like action after
all the other parts are met.


Thanks, Mike.  For organizational and reusability purposes, a plugin might ultimately be the right way to go.

(Changed this thread's subject line)
Whether indirectly through a custom plugin, or directly through code jammed inside my Vagrantfile, in the end I will depend on the librarian gem.

Considering the Vagrantfile approach first - In the beginning portion of the Vagrantfile, how can I programmatically install gems that later portions of the file will 'require'?  Does anyone have any examples of this?  I've tried a few hacks but it seems like things might be complicated by the private Ruby configuration that Vagrant uses.

lukewpatterson

unread,
May 26, 2012, 1:30:29 AM5/26/12
to vagra...@googlegroups.com
On Friday, May 25, 2012 7:13:08 PM UTC-5, lukewpatterson wrote:
Considering the Vagrantfile approach first - In the beginning portion of the Vagrantfile, how can I programmatically install gems that later portions of the file will 'require'?  Does anyone have any examples of this?  I've tried a few hacks but it seems like things might be complicated by the private Ruby configuration that Vagrant uses.

for installing librarian gem in the Vagrantfile, for later use in the Vagrantfile, got this hack to work:

librarian_name = 'librarian'
librarian_version = '0.0.23'
begin
  Gem::Specification.find_by_name(librarian_name, librarian_version)
rescue Gem::LoadError
  begin
    require 'vagrant/environment'
    env = Vagrant::Environment.new
    env.cli('gem', 'install', librarian_name, '--version', librarian_version)
  rescue SystemExit
  end
end

not sure how advisable it is, I guess I'll find out

Anentropic

unread,
Apr 23, 2013, 3:46:40 PM4/23/13
to vagra...@googlegroups.com
plugin to re-instate the `vagrant gem` command from v1.0.7
https://github.com/anentropic/vagrant-gem

On Tuesday, 23 April 2013 19:49:18 UTC+1, Anentropic wrote:
I get:

Message: deadlock; recursive locking

...when I try to do this under Vagrant 1.2
Did anyone get this working?

it's this line that seems to cause it:
env = Vagrant::Environment.new

The code is a bit different to the old `vagrant gem` command
Reply all
Reply to author
Forward
0 new messages