brunno grillo
brunno grillo

Reputation: 25

HomebrewUser error when Vagrant up

I'm trying to create a Ubuntu machine with Vagrant and Chef Solo. So, I've created a simple Vagrantfile and a simple recipe, just to test it. But I'm facing with the following error message:

Recipe Compile Error in /tmp/vagrant-chef/f10d707023a689f28124f5dcfaadbc2a/cookbooks/homebrew/libraries/helpers.rb

==> default: NameError
==> default: uninitialized constant Chef::Mixin::HomebrewUser
==> default: Cookbook Trace:
==> default: /tmp/vagrant-chef/f10d707023a689f28124f5dcfaadbc2a/cookbooks/homebrew/libraries/helpers.rb:23:in
<class:Chef12HomebrewUser>'<br/> ==> default: /tmp/vagrant-chef/f10d707023a689f28124f5dcfaadbc2a/cookbooks/homebrew/libraries/helpers.rb:22:in<br/> '
==> default:
==> default: Relevant File Content:
==> default: /tmp/vagrant-chef/f10d707023a689f28124f5dcfaadbc2a/cookbooks/homebrew/libraries/helpers.rb:
==> default:
==> default: 16: # distributed under the License is distributed on an "AS IS" BASIS,
==> default: 17: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
==> default: 18: # See the License for the specific language governing permissions and
==> default: 19: # limitations under the License.
==> default: 20: #
==> default: 21:
==> default: 22: class Chef12HomebrewUser
==> default: 23>> include Chef::Mixin::HomebrewUser
==> default: 24: end
==> default: 25:
==> default: 26: module Homebrew
==> default: 27: extend self # rubocop:disable ModuleFunction
==> default: 28:
==> default: 29: def exist?
==> default: 30: Chef::Log.debug('Checking to see if the homebrew binary exists')
==> default: 31: ::File.exist?('/usr/local/bin/brew')
==> default: 32: end
==> default:

Below there are my files:

Vagrantfile

Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"

  config.berkshelf.enabled = true
  config.berkshelf.berksfile_path = "./cookbooks/teste/Berksfile"

  config.vm.provision "chef_solo" do |chef|
   chef.install = false
   chef.add_recipe "teste"
  end
end

Berksfile

source 'https://supermarket.chef.io'

metadata

default.rb

include_recipe 'apt::default'
include_recipe 'java::default'

attributes.rb

default['java']['install_flavor'] = 'openjdk'
default['java']['jdk_version'] = '8'
default['java']['accept_license_agreement'] = true

metadata.rb

name 'teste'
maintainer 'The Authors'
maintainer_email '[email protected]'
license 'All Rights Reserved'
description 'Installs/Configures teste'
long_description 'Installs/Configures teste'
version '0.1.0'
chef_version '>= 12.1' if respond_to?(:chef_version)

depends 'apt'
depends 'java'

About my configuration:

Chef Development Kit Version: 2.3.4
chef-client version: 13.4.19
berks version: 6.3.1
kitchen version: 1.17.0
inspec version: 1.36.1

Vagrant 2.0.1

macOS Sierra (10.12.6)

Upvotes: 0

Views: 82

Answers (1)

brunno grillo
brunno grillo

Reputation: 25

I could fix that adding config.omnibus.chef_version = :latest on Vangratfile. It means Vagrant will use the latest version for chef everytime.

Upvotes: 0

Related Questions