[chef] Undefined Method drives Sous Chef Mad. Film at 11.


Chronological Thread 
  • From: Ross Mohan < >
  • To: " " < >
  • Subject: [chef] Undefined Method drives Sous Chef Mad. Film at 11.
  • Date: Wed, 19 Feb 2014 14:14:28 +0000
  • Accept-language: en-US

Running a trivial "hello world" recipe as chef-solo

sudo chef-solo -c solo.rb -j node.json​​

This all runs on the same machine. Solo.rb  points to my local cookbook subdir under ~/chef-repo; node.json is a one-liner run list of the recipe. 


The recipe looks for a file in my homedir, and if not there, does :create_if_missing

Or so I wish. 

It cr*ps out an undefined method on cookbook_file:



NoMethodError

-------------

undefined method `cookbook_file' for Chef::Resource::Log



Cookbook Trace:

---------------

  /Users/rossmohan/chef-repo/cookbooks/hellocookbook/recipes/hellorecipe.rb:5:in `block in from_file'

  /Users/rossmohan/chef-repo/cookbooks/hellocookbook/recipes/hellorecipe.rb:3:in `from_file'



Relevant File Content:

----------------------

/Users/rossmohan/chef-repo/cookbooks/hellocookbook/recipes/hellorecipe.rb:


  1:  # This is a Chef recipe file. It can be used to specify resources which will

  2:  # apply configuration to a server.

  3:  log "Welcome to Chef, #{node["starter_name"]}!" do

  4:    level :info

  5>>     cookbook_file "helloworld.txt" do

  6:        path "/Users/rossmohan/HELLOWORLD.TXT"

  7:        action :create_if_missing

  8:  end

  9:  end

 10: ​




cookbook_file undefined? I thought that was a built-in? 

Worse, looking in /var/chef for the stacktrace, top error is CookbookNotFound. 

But aye, laddie, 'tis there:


rosss-air:chef-repo rossmohan$ pwd

/Users/rossmohan/chef-repo

rosss-air:chef-repo rossmohan$ ls cookbooks

apache2 apt chefignore hellocookbook starter

rosss-air:chef-repo rossmohan$ knife cookbook list

apache2         1.8.14

apt             2.3.8

hellocookbook   0.1.0



Even knife sees it. 

Any thoughts on what to look at next? 


Thanks in advance, 

-Ross



















Archive powered by MHonArc 2.6.16.

§