chef-boneyard / vagrant-omnibus

A Vagrant plugin that ensures the desired version of Chef is installed via the platform-specific Omnibus packages.
Apache License 2.0
551 stars 63 forks source link

Plugin insists on installing latest Chef #108

Closed mathomas closed 9 years ago

mathomas commented 9 years ago

Vagrant version: 1.7.1 vagrant-omnibus: 1.4.1

"Suddenly" it seems like Vagrant/Omnibus insists on installing the latest Chef regardless of my chef_version setting. I hate words like "suddenly", but it seems sudden to me :-). Perhaps the problem has been there all along and it really only matters to me lately, since Chef 12.x was released(?).

I really don't want the very latest version of Chef, for various reasons, but the main reason is that the Java cookbook seems to misbehave under that version. But that is beside the point.

I have an example Vagrantfile like so:

VAGRANTFILE_API_VERSION = '2'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.hostname = "test"

  config.omnibus.chef_version = "11.8.2"

  #------------------
  # VirtualBox Config
  #------------------
  config.vm.provider :virtualbox do |vb, override|
    vb.name = 'test'
    vb.gui = false
    override.ssh.username = 'vagrant'
  end

  #------------------
  # Provision the Box
  #------------------
  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = ENV['CHEF_COOKBOOKS_PATH']
    chef.add_recipe 'java'

    chef.json = {
        'java' => {
            'jdk' => {
                '7' => {
                    'x86_64' => {
                        'url' => 'file:///vagrant/jdk-7u60-linux-x64.tar.gz'
                    }
                }
            },
            'install_flavor' => 'oracle',
            'jdk_version' => '7',
            'oracle' => {
                'accept_oracle_download_terms' => true
            }
        }
    }
  end
end

So, you can see that I'm trying to lock my VM down to Chef 11.8.2, as demonstrated by the chef version set in the Vagrantfile above.

However, when I do a "vagrant up" with the above, I get the following:

==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Mounting shared folders...
    default: /vagrant => /private/tmp/test
    default: /tmp/vagrant-chef-5/chef-solo-1/cookbooks => /Users/mthomas/Code/chef/cookbooks/meta/vendor/cookbooks
==> default: Chef 11.8.2 Omnibus package is already installed.
==> default: Running provisioner: chef_solo...
    default: Installing Chef (latest)...
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: stdin: is not a tty
==> default: [2015-01-06T00:19:10+00:00] INFO: Forking chef instance to converge...
==> default: [2015-01-06T00:19:10+00:00] INFO: *** Chef 12.0.3 ***

Which then goes on to fail the Java install due to the checksum issue that seems to have been introduced with Chef 12.

I must be doing something stupid to deserve this, although I've been swimming happily along with Vagrantfiles very much like this for a year or so now. Can someone shed some light?

mathomas commented 9 years ago

Never mind :-). Appears that this is a problem with 11.8.2 specifically. If I change to 11.10.0, then that version of Chef gets installed. Very odd. Anyway, 11.10 is compatible with our AWS OpsWorks configuration, so all the better.