Where does berks store files on file system on Windows?

I’m using berks to install dependencies for downloaded cookbook (chef-client) and it works with no errors and yet I don’t see any cookbooks on file system. Berks tell me that cookbook is already installed though. There is no folder called “.berkshelf” either. Running berks --debug also tells that cookbooks are installed

I, [2016-05-18T14:37:17.587600 #12256] INFO – : Installing chef_handler (1.4.0)
D, [2016-05-18T14:37:17.587600 #12256] DEBUG – : Already installed - skipping install
Using chef_handler (1.4.0)
I, [2016-05-18T14:37:17.587600 #12256] INFO – : Installing cron (1.7.6)
D, [2016-05-18T14:37:17.587600 #12256] DEBUG – : Already installed - skipping install

Usually in c:\users\yourusername.berkshelf

Thanks. It’s there in fact.
Does chef-client respects this location in locating cookbooks? When I run chef-client --local-mode it complaints it can not find “chef-client” cookbook despite the fact that berks downloaded it into that location mentioned.

[ADMIN]: PS > chef-client --local-mode .\attributes\default.rb
[2016-05-18T15:02:37-05:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at C:/chef
One version per cookbook

Starting Chef Client, version 12.7.2
[2016-05-18T15:02:41-05:00] INFO: *** Chef 12.7.2 ***
[2016-05-18T15:02:41-05:00] INFO: Chef-client pid: 14496
[2016-05-18T15:03:20-05:00] INFO: Run List is [recipe[iis_dsc]]
[2016-05-18T15:03:20-05:00] INFO: Run List expands to [iis_dsc]
[2016-05-18T15:03:20-05:00] INFO: Starting Chef Run for greg
[2016-05-18T15:03:20-05:00] INFO: Running start handlers
[2016-05-18T15:03:20-05:00] INFO: Start handlers complete.
[2016-05-18T15:03:20-05:00] INFO: HTTP Request Returned 404 Not Found: Object not found:
resolving cookbooks for run list: [“iis_dsc”]
[2016-05-18T15:03:20-05:00] INFO: HTTP Request Returned 412 Precondition Failed: No such cookbook: chef-client

================================================================================
Error Resolving Cookbooks for Run List:

Missing Cookbooks:

No such cookbook: chef-client

Expanded Run List:

  • iis_dsc

Running handlers:
[2016-05-18T15:03:20-05:00] ERROR: Running exception handlers
Running handlers complete
[2016-05-18T15:03:20-05:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 43 seconds
[2016-05-18T15:03:20-05:00] FATAL: Stacktrace dumped to c:/chef/.chef/local-mode-cache/cache/chef-stacktrace.out
[2016-05-18T15:03:20-05:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-05-18T15:03:20-05:00] FATAL: Net::HTTPServerException: 412 “Precondition Failed”
[ADMIN]: PS >

Chef-client will pull the cookbooks down from the Chef server, not look at the local Berkshelf directory, typically, unless you’re actually using chef-solo/chef-zero instead of chef-client.

Nathan Clemons
DevOps Engineer
Moxie Cloud Services (MCS)

O +1.425.467.5075
M +1.360.861.6291
E nclemons@gomoxie.com
W www.gomoxie.comhttp://www.gomoxie.com/

Yes, in --local-mode it’s using chef-zero (Per log below)

[ADMIN]: PS > chef-client --local-mode
[2016-05-18T15:27:31-05:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at C:/chef
  One version per cookbook

Starting Chef Client, version 12.7.2
[2016-05-18T15:27:35-05:00] INFO: *** Chef 12.7.2 ***
[2016-05-18T15:27:35-05:00] INFO: Chef-client pid: 14860
[2016-05-18T15:27:43-05:00] INFO: Run List is [recipe[iis_dsc]]
[2016-05-18T15:27:43-05:00] INFO: Run List expands to [iis_dsc]
[2016-05-18T15:27:43-05:00] INFO: Starting Chef Run for greg
[2016-05-18T15:27:43-05:00] INFO: Running start handlers
[2016-05-18T15:27:43-05:00] INFO: Start handlers complete.
[2016-05-18T15:27:43-05:00] INFO: HTTP Request Returned 404 Not Found: Object not found:
resolving cookbooks for run list: ["iis_dsc"]
[2016-05-18T15:27:43-05:00] INFO: HTTP Request Returned 412 Precondition Failed: No such cookbook: chef-client

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================

Missing Cookbooks:
------------------
No such cookbook: chef-client

Expanded Run List:
------------------
* iis_dsc


Running handlers:
[2016-05-18T15:27:43-05:00] ERROR: Running exception handlers
Running handlers complete
[2016-05-18T15:27:43-05:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 12 seconds
[2016-05-18T15:27:43-05:00] FATAL: Stacktrace dumped to c:/chef/.chef/local-mode-cache/cache/chef-stacktrace.out
[2016-05-18T15:27:43-05:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-05-18T15:27:43-05:00] FATAL: Net::HTTPServerException: 412 "Precondition Failed"

What are you trying to do with Chef Zero?

The best way to find out how it works is by using test kitchen. After a kitchen run hop on to the VM, kitchen will have transferred cookbook files and created a client.rb for you.

Alternatively for running a simple cookbook take a look at this excellent blog post https://www.chef.io/blog/2013/10/31/chef-client-z-from-zero-to-chef-in-8-5-seconds/

I’m trying to test my recipe locally on my host by running “chef-client --local-mode” which relies on chef-zero to emulate server my understanding.