Chef-zero messed up


#1

I was playing with chef provisioning using chef-zero for the first time (both). I decided to start fresh again, so blew away the repo that i created while playing with chef provisioning. Now, with a new repo, chef-zero have gone crazy. it still says starting chef-zero in the old file path (/home/okram/workspace/chefprov/chefprov). I have rm -rf 'ed this dir.

And this a part of the console error. How do i correct this chef-zero???

± |master ?:10 ✗| → chef-client -z
[2015-11-19T18:42:48-08:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /home/okram/workspace/chefprov/chefprov
One version per cookbook

[2015-11-19T18:42:48-08:00] INFO: Forking chef instance to converge…
Starting Chef Client, version 12.5.1
[2015-11-19T18:42:48-08:00] INFO: *** Chef 12.5.1 ***
[2015-11-19T18:42:48-08:00] INFO: Chef-client pid: 15823
[2015-11-19T18:42:50-08:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/provisioner3
[2015-11-19T18:42:50-08:00] ERROR: #<Errno::ENOENT: No such file or directory @ dir_s_mkdir - /home/okram/workspace/chefprov/chefprov/nodes>
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb:97:in mkdir' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb:97:inblock in create_child’
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb:95:in each' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb:95:increate_child’
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/chef_fs/chef_fs_data_store.rb:469:in get_dir' /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.5.1/lib/chef/chef_fs/chef_fs_data_store.rb:456:inwith_dir’


#2

Do you have a client.rb file? That is where the location of your chef-zero repository would be specified. You can specify the location of the client.rb file with the -c option in chef-client, or else it uses the standard default locations.

Kevin Keane
The NetTech
http://www.4nettech.com
Our values: Privacy, Liberty, Justice
See https://www.4nettech.com/corp/the-nettech-values.html


#3

i have a knife.rb and i added the absolute path for the cookbook.

log_level :info
current_dir = File.dirname(FILE)
node_name "provisioner"
client_key “#{current_dir}/dummy.pem"
validation_client_name “validator"
cookbook_path [”/home/provisioner/workspace/chefprov/cookbooks/berks-cookbooks”]

And this recovered from the error, but now i see multiple nodes folders in my chef-repo.

  1. under the chefprov (the chef-repo)
  2. under the chefprov/cookbooks

This is the repo that i have. https://github.com/okram999/chefprov

I was following this https://christinemdraper.wordpress.com/2015/01/31/deploying-a-multi-node-application-to-aws-using-chef-provisioning/ to check out the chef provisioning. But this is becoming a ride

Another thing that i am still looking at is the local mode chef is not able to find the recipes

] ERROR: could not find recipe file /home/provisioner/workspace/chefprov/cookbooks/berks-cookbooks/start123/start123::aws-setup

Any idea?


#4

Niristotle,

The blog is using individual provisioning recipe files located in the
chef-repo root, as a basic getting started. You quite reasonably want to
put them in a cookbook. When you do this, though, you’ll need to invoke
provisioning using:

chef-client -z -r “start123::aws-setup”

and when you want to run multiple recipes:

chef-client -z -r “start123::aws-setup, start123::topo”

This works for me using your repo. The -r option sets the runlist of your
local provisioning node, so once you have it containing the recipes you
want, you can actually rerun it just by running

chef-client -z

You can also use the -o option to run a specific recipe on a one-off basis,
without changing the saved runlist.

The reason you are seeing two nodes directories is that when you changed
the cookbook path, the default location of the repo changed (to be the
parent directory of the new cookbook directory). You can restore it to its
normal place by adding the following in knife.rb:

chef_repo_path “#{current_dir}/…”

Hope that helps.

Regards,
Christine