I am working on a Chef recipe and now I would like to know how debugging of recipes can be done. This seems to be not all straightforward.
For example adding simple log statements is unclear. I can use for example
Chef::Log.info "My message"
But it is unclear where this message will be logged. It doesn't appear in the chef client run console even with verbose output for example as follows
knife ssh mynode "sudo chef-client" --manual-list --ssh-user myuser -VV
The best/most advanced way I found so far for debugging to just raise an exception. Not at all advanced.
Here you're setting knife
command as verbose with -VV
.
To change chef-client
run log level the parameter is -l info
or -l debug
for its command call.
In your command line it would give (info level, debug is really verbose, and you're loggin at info level in your recipe):
knife ssh mynode "sudo chef-client -l info" --manual-list --ssh-user myuser -VV
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With