websterclay / knife-github-cookbooks

A knife plugin facilitating installing, updating, and tracking Chef cookbooks found on Github.
Apache License 2.0
220 stars 35 forks source link

undefined method `first' #23

Open memelet opened 12 years ago

memelet commented 12 years ago

When I run, for example, knife cookbook github -VV install librato/papertrail-cookbook I get the below. I am using ruby 1.9.3-p194. Is this related to http://tickets.opscode.com/browse/CHEF-1532? (BTW, I know very little ruby).

DEBUG: Using configuration from /home/bkaplan/.chef/knife.rb /home/bkaplan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/knife-github-cookbooks-0.1.6/lib/chef/knife/cookbook_github_install.rb:72:in run': undefined methodfirst' for "~/si/ops/chef-repo/cookbooks":String (NoMethodError) from /home/bkaplan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/knife.rb:402:in run_with_pretty_exceptions' from /home/bkaplan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/knife.rb:168:inrun' from /home/bkaplan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/application/knife.rb:123:in run' from /home/bkaplan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/chef-10.12.0/bin/knife:25:in<top (required)>' from /home/bkaplan/.rbenv/versions/1.9.3-p194/bin/knife:23:in load' from /home/bkaplan/.rbenv/versions/1.9.3-p194/bin/knife:23:in

'

patjenk commented 12 years ago

In your knife.rb file (home/bkaplan/.chef/knife.rb) your cookbook_path is set to a string instead of an array. For example, it probably looks like

cookbook_path  "/home/bkaplan/mycookbooks"

if you change it to

cookbook_path  ["/home/bkaplan/mycookbooks"]

You'll be able to install cookbooks.

It looks like the opscode documentation for knife (http://wiki.opscode.com/display/chef/Chef+Configuration+Settings) says the cookbook_path value can be an array or string. If you check for the type on line 72 in lib/chef/knife/cookbook_github_install.rb you can fix this error.