InterviewSolution
| 1. |
What are the various debugging techniques used to debug chef-client run failures? |
|
Answer» Best practices in developing a cookbook are to use
These techniques help us to REDUCE the debugging EFFORT greatly. Main debugging techniques used to detect defects in recipes and chef-client runs are
Run Chef Client with an empty run list. This helps us to make sure that the chef-client run failure is not due to the recipes added in the run list. We are also now sure that the failure is due to the configuration settings of Chef Client. chef-client run failure could also occur due to permission issues of the user at Chef Server and also on the node where Chef Client is run.
A built-in verbose logging of knife with “-v” option could be used to log messages
Chef Client could be run with verbose logging by using the “-l” option. “-L” option could also be used to specify the location of the log file.
log resource could be used to log the debug messages while running the Chef Client. This resource is also built into resource collection and run during the convergence phase. If we want to add log ENTRIES that are not added to the resource collection, use Chef:: Log. A sample log resource looks as below: log 'mtr' do message 'A info message added.' level :info endWhere
|
|