Error with homebrew_package


#1

Running into the following error:

Recipe: moxie-jenkins::osxjenkins
  * homebrew_package[android-sdk] action install
    
    ================================================================================
    Error executing action `install` on resource 'homebrew_package[android-sdk]'
    ================================================================================
    
    NoMethodError
    -------------
    undefined method `chomp' for nil:NilClass
    
    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/homebrew/libraries/homebrew_package.rb:94:in `get_version_from_formula'
    /var/chef/cache/cookbooks/homebrew/libraries/homebrew_package.rb:74:in `current_installed_version'
    /var/chef/cache/cookbooks/homebrew/libraries/homebrew_package.rb:44:in `load_current_resource'
    
    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/moxie-jenkins/recipes/osxjenkins.rb
    
     32:   homebrew_package pkg do
     33:     homebrew_user 'moxie'
     34:     action :install
     35:     version ver
     36:   end
     37: end
    
    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/moxie-jenkins/recipes/osxjenkins.rb:32:in `block in from_file'
    
    homebrew_package("android-sdk") do
      package_name "android-sdk"
      action [:install]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :homebrew_package
      cookbook_name "moxie-jenkins"
      recipe_name "osxjenkins"
      homebrew_user "moxie"
      version "25.1.1"
    end
    
    Platform:
    ---------
    x86_64-darwin13.0
    

Running handlers:
[2016-04-22T12:26:49-07:00] ERROR: Running exception handlers
Running handlers complete
[2016-04-22T12:26:49-07:00] ERROR: Exception handlers complete
Chef Client failed. 3 resources updated in 08 seconds
[2016-04-22T12:26:49-07:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2016-04-22T12:26:49-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-04-22T12:26:49-07:00] ERROR: homebrew_package[android-sdk] (moxie-jenkins::osxjenkins line 32) had an error: NoMethodError: undefined method `chomp' for nil:NilClass
[2016-04-22T12:26:49-07:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

The recipe looks like so:

node.override['homebrew']['owner'] = 'moxie'

include_recipe 'homebrew'

brews = {
  'android-sdk' => '25.1.1',
  'android-platform-tools' => '23.1'
}

brews.each do |pkg, ver|
  homebrew_package pkg do
    homebrew_user 'moxie'
    action :install
    version ver
  end
end