-
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
Introducing safels and safetree commands to the consul-template. #1132
Conversation
safels and safetree behave exactly like the native ls and tree with one exception. They will *refuse* to render template, if KV prefix query return blank/empty data. This is especially usefull for rendering mission critical files that do not tolerate ls/tree KV queries to return blank data. safels and safetree work in stale mode just as their ancestors but we get extra safety on top. safels and safetree commands were born as an attempt to mitigate issues described here: hashicorp#1131 hashicorp/consul#3975 hashicorp/consul-replicate#82
…aming convention (key, keyOrDefault etc.) renaming safels to safeLs and safetree to safeTree
Might avoid doing hashicorp/consul-template#1132 And might fix the following bugs: * hashicorp/consul-replicate#82 * hashicorp#3975 * hashicorp/consul-template#1131
Might not be needed since root cause is fIxed by hashicorp/consul#4554 |
Hey @vaLski, thanks for the PR. In light of hashicorp/consul#4554 do you still think this is a good addition? @mitaka, @dkanchev. You both 👍'd this... what do you think? Thanks. |
@eikenb Thank you for getting back to me. Indeed the root cause of the issue I reported was fixed. However if you think that the proposed changes are good enough and might help people preventing a disaster feel free to merge them or ask for further improvements. While evaluating, kindly note the following:
Feel free to comment. |
I think I'll accept this as new template functions don't really complicate the code base much as they are pretty well self contained. I have been asking other new function writer to provide function tests... but I'll let that slide here as this is implemented more as a tweak to an existing function vs. a brand new one. But if you feel like it.... feel free. :) |
This pull request is based on rough idea dropped by Aaron Hurt.
safels and safetree behave exactly like the native ls and tree with one exception. They will refuse to render template, if KV prefix query return blank/empty data.
This is especially useful for rendering mission critical files that do not tolerate ls/tree KV queries to return blank data.
safels and safetree work in stale mode just as their ancestors but we get extra safety on top.
safels and safetree commands were born as an attempt to mitigate issues described here:
#1131
hashicorp/consul#3975
hashicorp/consul-replicate#82