Chef Handlers - add run_list on failed recipe run
by keif from LinuxQuestions.org on (#5KMB9)
Hello, I am encountering an issue running a chef role for a new install.
When I run the role, sometimes an Ubuntu service is running or some other issue and this causes the run to fail. When the run fails, the chef-client it ran on does not get the role and run_list from the role assigned to it when I check the node on the chef server (since the run failed, assigning the role to the node fails too).
I need to find a way to run the recipes in the role so that even if there is an error, the role and run_list gets assigned to the client.
Also, I need to find a way that if a fail occurs, the remaining recipes that were on the run_list continue. Right now if one recipe fails, the whole run_list stops.
I have been able to "trick" chef with deliberate exit code 0 so that it thinks the recipe succeeds and the recipes continue (aka a terrible solution :-)
If anyone has solved this sort of thing, especially with handlers of some sort, then any advice would be appreciated. Thanks, Keith
When I run the role, sometimes an Ubuntu service is running or some other issue and this causes the run to fail. When the run fails, the chef-client it ran on does not get the role and run_list from the role assigned to it when I check the node on the chef server (since the run failed, assigning the role to the node fails too).
I need to find a way to run the recipes in the role so that even if there is an error, the role and run_list gets assigned to the client.
Also, I need to find a way that if a fail occurs, the remaining recipes that were on the run_list continue. Right now if one recipe fails, the whole run_list stops.
I have been able to "trick" chef with deliberate exit code 0 so that it thinks the recipe succeeds and the recipes continue (aka a terrible solution :-)
If anyone has solved this sort of thing, especially with handlers of some sort, then any advice would be appreciated. Thanks, Keith