-
Notifications
You must be signed in to change notification settings - Fork 781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetaure request: a way for consul-template to exit upon a failed key lookup #1637
Comments
Poked around this today trying to figure out the best solution. My current idea is to add a simple {{ if not (keyExists "foo") }}
{{ error "key foo doesn't exist" }}
{{end}} |
Oh.. and using the above with the |
That was naive. Templates always render once through with everything failing to look up. So any sort of exists check will always fail the first time triggering the error. |
Added it as a top level option that triggers the error on any data lookup that fails 2 fetch attempts. The error happens on the second attempt as the first attempt is a special case that does some setup. Note that setting this disables retries for failed lookup attempt errors. |
Does not seem to work. Template:
Executing as:
Hangs indefinitely. And I keep seeing in Consul logs:
Unless you mean that I should be checking if key exists from inside template? Then this feature makes very little sense to me. |
I can also confirm using Also tried passing a bool |
Requested feature is pretty straightforward and is simply that they want consul-template to exit with an error if a key it is looking up in Consul does not exist.
It should work with the
template_error_fatal
setting.Look into making this cover all backends but only if simple. Otherwise keep this consul specific.
The text was updated successfully, but these errors were encountered: