Wow. That was fast.
rosss-air:.chef rossmohan$ sudo chef-solo -c solo.rb -j node.json
Password:
Starting Chef Client, version 11.10.2
Compiling Cookbooks...
Converging 1 resources
Recipe: hellocookbook::hellorecipe
* cookbook_file[helloworld.txt] action create_if_missing
- create new file /Users/rossmohan/HELLOWORLD.TXT
- update content in file /Users/rossmohan/HELLOWORLD.TXT from none to 4ef28a
--- /Users/rossmohan/HELLOWORLD.TXT 2014-02-19 09:44:01.000000000 -0500
+++ /tmp/.helloworld.txt20140219-26170-mpfeit 2014-02-19 09:44:01.000000000 -0500
@@ -1 +1,4 @@
+This is the file I put in the files/default subdir of cookbook Hellocookbook for slurping up by chef(-solo) and placement in my homedir.
+
+Let's see if it worked.....
Running handlers:
Running handlers complete
Chef Client finished, 1/1 resources updated in 2.052297 seconds
I guess the prohibition on nesting execute resource blocks is inherited from Ruby.
Thank you!
I did try debugging via single-stepping chef-shell, but it gave me
hours of grief on "connection refused" (regardless of firewall state)
rosss-air:.chef rossmohan$ chef-shell
loading configuration: none (standalone session)
Session type: standalone
Loading...done.
This is the chef-shell.
Chef Version: 11.10.2
http://www.opscode.com/chef
http://docs.opscode.com/
run `help' for help, `exit' or ^D to quit.
Ohai2u
chef > cookbooks.all
[2014-02-19T10:11:42-05:00] ERROR: Connection refused connecting to https://localhost/cookbooks, retry 1/5
...
<snip>
Thanks again,
Ross
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:
cookbook_file undefined? I thought that was a built-in?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:
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.