0

I'm setting up my first Django VM with Vanguard following this guide. Ran into an error:

==> djangovm: [2014-10-20T15:04:09+02:00] ERROR: Running exception handlers
==> djangovm: [2014-10-20T15:04:09+02:00] ERROR: Exception handlers complete
==> djangovm: [2014-10-20T15:04:09+02:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> djangovm: [2014-10-20T15:04:09+02:00] FATAL: NameError: uninitialized constant Chef::Resource::LWRPBase

Found the answer here: Vagrant & Chef: uninitialized constant Chef::Resource::LWRPBase which says to refer to this answer: How to control the version of Chef that Vagrant uses to provision VMs?

I'm just not sure where do I put:

config.omnibus.chef_version = :latest

in my Vagrantfile?

My Vagrant file looks like that tutorial link exactly at the moment:

Vagrant::Config.run do |config|
  config.vm.define :djangovm do |django_config|
    # Every Vagrant virtual environment requires a box to build off of.
    django_config.vm.box = "lucid64"

    # The url from where the 'config.vm.box' box will be fetched if it
    # doesn't already exist on the user's system.
    django_config.vm.box_url = "http://files.vagrantup.com/lucid64.box"

    # Forward a port from the guest to the host, which allows for outside
    # computers to access the VM, whereas host only networking does not.
    django_config.vm.forward_port 80, 8080
    django_config.vm.forward_port 8000, 8001

    # Enable provisioning with chef solo, specifying a cookbooks path (relative
    # to this Vagrantfile), and adding some recipes and/or roles.
    #
    django_config.vm.provision :chef_solo do |chef|
      chef.cookbooks_path = "cookbooks"
      chef.add_recipe "apt"
      chef.add_recipe "apache2::mod_wsgi"
      chef.add_recipe "build-essential"
      chef.add_recipe "git"
      chef.add_recipe "vim"
    #
    #   # You may also specify custom JSON attributes:
    #   chef.json = { :mysql_password => "foo" }
     end
   end
 end

I tried adding it in like so:

# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
django_config.vm.box_url = "http://files.vagrantup.com/lucid64.box"

# This gets the latest version of Omnibus
config.omnibus.chef_version = :latest

Then did Vagrant Destroy then Vagrant Up and still got the same error.

Community
  • 1
  • 1
Ryan
  • 699
  • 4
  • 13
  • 30

1 Answers1

2

You can put it inside the :djangovm definition as you tried, but there you need to use

django_config.omnibus.chef_version = :latest

Of course you also have to install the vagrant-omnibus too:

vagrant plugin install vagrant-omnibus

Btw, it is safer to lock down the Chef version to a known version so your provision won't explode when Chef releases new major versions. So for example:

django_config.omnibus.chef_version = "11.6.4"
tmatilai
  • 4,071
  • 20
  • 24