Reputation: 453
I have a role made up of set of multiple recipes. I would like to continue the chef-client run even if one of the recipes in the role fails.
I am aware of the property "ignore_failure" which could be set at resource level, allowing execution of rest of the recipe even in case of failure.
However, my requirement is to skip the execution of current recipe in case of failure at any point and directly move to the next recipe in the role.
Apart from this I would not prefer to add "ignore_failure" to each resource. Is it possible to set something at recipe level , rather than resource level to achieve a similar behavior ?
Upvotes: 2
Views: 5223
Reputation: 15784
Short answer 'NO, there's no ignore_failure' at recipe level nor at run wide level.
Long form: you should not have failing recipes, if it fails it means you're missing guard to prevent execution of resources in specific cases or that you have an implementation problem somewhere.
The idea of an ignore failure run wide or at recipe level has been discussed and it raise some other questions, at which time should we raise or not a failure, is it at compile time (This one could be handled in pure Ruby with a try/catch) or converge time or at both ?
At the end of the day, the implementation of this feature would add a lot of complexity in chef code base to workaround bad implementation in 99% of cases.
Upvotes: 3