How to disable cookbook synchronization with chef-client?
Asked Answered
L

4

8

I would like to test/debug cookbooks. However, using chef-client to restart a chef run, this requires me to modify cookbooks, upload them to the chef server & synchronize cookbooks. I would like to be able to modify the cookbooks that were synchronized and stored in the cache, instead of having to upload every single little change I make at each iteration. Is this possible?

Thanks

tl;dr in chef-client, how to use the cached cookbooks instead of synchronizing them every time

Leveille answered 24/3, 2015 at 19:22 Comment(1)
This is useful when you want to add temporary logging to cookbooks without annoying the ops guys ;)Disinfection
B
18
chef-client --skip-cookbook-sync

Use cached cookbooks without overwriting local differences from the server. Use with caution. Useful for patching a set of cookbooks on a machine when iterating during development. New in Chef Client 12.8.1.

https://docs.chef.io/ctl_chef_client.html

Balsa answered 21/7, 2017 at 8:45 Comment(0)
C
1

For Chef prior version 12 command is chef-solo -z -o <cookbook_name>

Chocolate answered 19/10, 2017 at 9:56 Comment(0)
B
0

You can use chef-client in local mode (see here and here).

But beware that this uses everything from the local disk, also environments, roles and data bags.

For development, test-kitchen is the tool of choice, which might ease your pain.

Brezhnev answered 25/3, 2015 at 5:56 Comment(0)
G
0

You can try a command something like this:

chef-client --local -o 'recipe[cookbookname::recipie]' --log_level info

or

chef-client -z -o 'recipe[cookbookname::recipie]' --log_level info
Gandzha answered 14/1, 2016 at 16:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.