sous-chefs / homebrew

Development repository for the homebrew cookbook
https://supermarket.chef.io/cookbooks/homebrew
Apache License 2.0
152 stars 136 forks source link

fail to install brew-cask with homebrew_package #104

Closed cwong47 closed 8 years ago

cwong47 commented 8 years ago

Cookbook version

1.13.0

Chef-client version

12.12.15

Platform Details

osx 10.10.5 - Darwin Kernel Version 14.5.0

Scenario:

i have a list of packages that i want to install using the cookbook, including another list of casks

Steps to Reproduce:

this is my recipe calling homebrew -

include_recipe 'homebrew'
include_recipe 'homebrew::cask'

unless node['databag_items']['packages']['darwin']['install'].nil?
  node['databag_items']['packages']['darwin']['install'].each do |install|
    package install
  end
end

unless node['databag_items']['packages']['darwin']['cask'].nil?
  node['databag_items']['packages']['darwin']['cask'].each do |install|
    homebrew_cask install
  end
end

Expected Result:

expecting the packages/casks to get installed

Actual Result:

output of --why-run

* homebrew_package[brew-cask] action install

  ================================================================================
  Error executing action `install` on resource 'homebrew_package[brew-cask]'
  ================================================================================

  NoMethodError
  -------------
  undefined method `chomp' for nil:NilClass

  Cookbook Trace:
  ---------------
  /Users/cwong/.chef/local-mode-cache/cache/cookbooks/homebrew/libraries/homebrew_package.rb:94:in `get_version_from_formula'
  /Users/cwong/.chef/local-mode-cache/cache/cookbooks/homebrew/libraries/homebrew_package.rb:74:in `current_installed_version'
  /Users/cwong/.chef/local-mode-cache/cache/cookbooks/homebrew/libraries/homebrew_package.rb:44:in `load_current_resource'
  /Users/cwong/.chef/local-mode-cache/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'

  Resource Declaration:
  ---------------------
  # In /Users/cwong/.chef/local-mode-cache/cache/cookbooks/homebrew/recipes/cask.rb

   23: package 'brew-cask'
   24:

  Compiled Resource:
  ------------------
  # Declared in /Users/cwong/.chef/local-mode-cache/cache/cookbooks/homebrew/recipes/cask.rb:23:in `from_file'

  homebrew_package("brew-cask") do
    package_name "brew-cask"
    action [:install]
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    declared_type :package
    cookbook_name "homebrew"
    recipe_name "cask"
  end
cwong47 commented 8 years ago

looks like i had to run it as sudo.. hmmm