runner: isolate template errors instead of aborting all templates [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT] - #2163
Conversation
When one template in a multi-template configuration encounters a fatal error (ErrFatal=true), the Run() method currently returns immediately, skipping all remaining templates. This causes the entire runner to stop after the first failed template, and all previously successful templates are re-processed on restart. Fix: collect template errors and continue processing the remaining templates. At the end of Run(), if at least one template rendered successfully, log a warning and return nil (don't stop the runner). If all templates failed, return an error so the caller can decide whether to stop or continue. Fixes hashicorp/vault#32035
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes waterWang seems not to be a GitHub user. Have you signed the CLA already but the status is still pending? Recheck it. |
1 similar comment
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes waterWang seems not to be a GitHub user. Have you signed the CLA already but the status is still pending? Recheck it. |
tgross
left a comment
There was a problem hiding this comment.
No one can review this till the CLA is signed . I'd ask reviewers to consider how this impacts other downstream projects like Nomad template blocks. Especially given the bug reported in Vault this is trying to fix was not acknowledged by the Vault team so maybe they intend for this behavior.
Description
When one template in a multi-template Vault Agent configuration encounters a fatal error (e.g., an
exec {}template function fails), the consul-template runner'sRun()method returns immediately after the first failure, skipping all remaining templates.This means:
exec {}block causes templates B, C, D to be skippedErrChFix
Collect template errors and continue processing the remaining templates:
nil(don't stop the runner — the failed template will be retried on the next dependency change)Changes
manager/runner.go— 20 lines added, 1 deletedRelated issue
Fixes hashicorp/vault#32035