You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
consul {
address="192.168.122.1:8500"
}
template {
source="/tmp/test.ctmpl"destination="/tmp/test.out"
}
{{ key"mykey" | parseInt }}
123
Command
consul-template -config test.hcl
Debug output
2020/10/28 23:02:53.719058 [INFO] consul-template v0.25.1 (b11fa800)
2020/10/28 23:02:53.719072 [INFO] (runner) creating new runner (dry: false, once: false)
2020/10/28 23:02:53.719304 [DEBUG] (runner) final config: {"Consul":{"Address":"192.168.122.1:8500","Namespace":"","Auth":{"Enabled":false,"Username":"","Password":""},"Retry":{"Attempts":12,"Backoff":250000000,"MaxBackoff":60000000000,"Enabled":true},"SSL":{"CaCert":"","CaPath":"","Cert":"","Enabled":false,"Key":"","ServerName":"","Verify":true},"Token":"","Transport":{"DialKeepAlive":30000000000,"DialTimeout":30000000000,"DisableKeepAlives":false,"IdleConnTimeout":90000000000,"MaxIdleConns":100,"MaxIdleConnsPerHost":4,"TLSHandshakeTimeout":10000000000}},"Dedup":{"Enabled":false,"MaxStale":2000000000,"Prefix":"consul-template/dedup/","TTL":15000000000,"BlockQueryWaitTime":60000000000},"DefaultDelims":{"Left":null,"Right":null},"Exec":{"Command":"","Enabled":false,"Env":{"Denylist":[],"Custom":[],"Pristine":false,"Allowlist":[]},"KillSignal":2,"KillTimeout":30000000000,"ReloadSignal":null,"Splay":0,"Timeout":0},"KillSignal":2,"LogLevel":"trace","MaxStale":2000000000,"PidFile":"","ReloadSignal":1,"Syslog":{"Enabled":false,"Facility":"LOCAL0","Name":"consul-template"},"Templates":[{"Backup":false,"Command":"","CommandTimeout":30000000000,"Contents":"","CreateDestDirs":true,"Destination":"/tmp/test.out","ErrMissingKey":false,"Exec":{"Command":"","Enabled":false,"Env":{"Denylist":[],"Custom":[],"Pristine":false,"Allowlist":[]},"KillSignal":2,"KillTimeout":30000000000,"ReloadSignal":null,"Splay":0,"Timeout":30000000000},"Perms":0,"Source":"/tmp/test.ctmpl","Wait":{"Enabled":false,"Min":0,"Max":0},"LeftDelim":"","RightDelim":"","FunctionDenylist":[],"SandboxPath":""}],"Vault":{"Address":"http://192.168.122.1:8200","Enabled":true,"Namespace":"","RenewToken":false,"Retry":{"Attempts":12,"Backoff":250000000,"MaxBackoff":60000000000,"Enabled":true},"SSL":{"CaCert":"","CaPath":"","Cert":"","Enabled":true,"Key":"","ServerName":"","Verify":true},"Transport":{"DialKeepAlive":30000000000,"DialTimeout":30000000000,"DisableKeepAlives":false,"IdleConnTimeout":90000000000,"MaxIdleConns":100,"MaxIdleConnsPerHost":4,"TLSHandshakeTimeout":10000000000},"UnwrapToken":false},"Wait":{"Enabled":false,"Min":0,"Max":0},"Once":false,"BlockQueryWaitTime":60000000000}
2020/10/28 23:02:53.719352 [INFO] (runner) creating watcher
2020/10/28 23:02:53.719535 [INFO] (runner) starting
2020/10/28 23:02:53.719637 [DEBUG] (runner) running initial templates
2020/10/28 23:02:53.719665 [DEBUG] (runner) initiating run
2020/10/28 23:02:53.719693 [DEBUG] (runner) checking template dfe4ece652c1cad0a4fd3f9dd363a909
2020/10/28 23:02:53.720069 [DEBUG] (runner) missing data for 1 dependencies
2020/10/28 23:02:53.720102 [DEBUG] (runner) missing dependency: kv.block(mykey)
2020/10/28 23:02:53.720120 [DEBUG] (runner) add used dependency kv.block(mykey) to missing since isLeader but do not have a watcher
2020/10/28 23:02:53.720174 [DEBUG] (runner) was not watching 1 dependencies
2020/10/28 23:02:53.720196 [DEBUG] (watcher) adding kv.block(mykey)
2020/10/28 23:02:53.720245 [TRACE] (watcher) kv.block(mykey) starting
2020/10/28 23:02:53.720255 [DEBUG] (runner) diffing and updating dependencies
2020/10/28 23:02:53.720264 [DEBUG] (runner) watching 1 dependencies
2020/10/28 23:02:53.720311 [TRACE] (view) kv.block(mykey) starting fetch
2020/10/28 23:02:53.720334 [TRACE] kv.block(mykey): GET /v1/kv/mykey?stale=true&wait=1m0s
2020/10/28 23:02:53.721692 [TRACE] kv.block(mykey): returned "123"
2020/10/28 23:02:53.721716 [TRACE] (view) kv.block(mykey) marking successful data response
2020/10/28 23:02:53.721730 [TRACE] (view) kv.block(mykey) successful contact, resetting retries
2020/10/28 23:02:53.835671 [TRACE] (view) kv.block(mykey) received data
2020/10/28 23:02:53.835721 [TRACE] (view) kv.block(mykey) starting fetch
2020/10/28 23:02:53.835733 [DEBUG] (runner) receiving dependency kv.block(mykey)
2020/10/28 23:02:53.835741 [DEBUG] (runner) initiating run
2020/10/28 23:02:53.835749 [DEBUG] (runner) checking template dfe4ece652c1cad0a4fd3f9dd363a909
2020/10/28 23:02:53.835878 [TRACE] kv.block(mykey): GET /v1/kv/mykey?index=214686&stale=true&wait=1m0s
2020/10/28 23:02:53.835996 [DEBUG] (runner) rendering "/tmp/test.ctmpl" => "/tmp/test.out"
2020/10/28 23:02:53.836214 [DEBUG] (runner) diffing and updating dependencies
2020/10/28 23:02:53.836234 [DEBUG] (runner) kv.block(mykey) is still needed
2020/10/28 23:02:53.836244 [DEBUG] (runner) watching 1 dependencies
2020/10/28 23:02:53.836250 [DEBUG] (runner) all templates rendered
2020/10/28 23:02:59.619763 [TRACE] kv.block(mykey): returned "123abc"
2020/10/28 23:02:59.619800 [TRACE] (view) kv.block(mykey) marking successful data response
2020/10/28 23:02:59.619831 [TRACE] (view) kv.block(mykey) successful contact, resetting retries
2020/10/28 23:02:59.619839 [TRACE] (view) kv.block(mykey) received data
2020/10/28 23:02:59.619862 [TRACE] (view) kv.block(mykey) starting fetch
2020/10/28 23:02:59.619880 [TRACE] kv.block(mykey): GET /v1/kv/mykey?index=214688&stale=true&wait=1m0s
2020/10/28 23:02:59.620012 [DEBUG] (runner) receiving dependency kv.block(mykey)
2020/10/28 23:02:59.620027 [DEBUG] (runner) initiating run
2020/10/28 23:02:59.620032 [DEBUG] (runner) checking template dfe4ece652c1cad0a4fd3f9dd363a909
2020/10/28 23:02:59.620523 [ERR] (cli) /tmp/test.ctmpl: execute: template: :1:17: executing "" at <parseInt>: error calling parseInt: parseInt: strconv.ParseInt: parsing "123abc": invalid syntax
Expected behavior
Should log and error and continue.
Actual behavior
Exits with error message
Steps to reproduce
Run with above config
Change consul key from 123 to 123abc
References
Additional info
The documentation clearly states:
By default Consul Template is highly fault-tolerant. If Consul is unreachable or a template changes, Consul Template will happily continue running. The only exception to this rule is if the optional command exits non-zero. In this case, Consul Template will also exit non-zero.
In this case the optional command is not used, so consul-template should not exit. It should log an error and continue running.
This is especially problematic if consul-template is handling multiple templates. An error in a single template should not cause all other templates to stop rendering.
The text was updated successfully, but these errors were encountered:
Hey @phemmer, thanks for taking the time to file this ticket.
Related issue talks about adding an option to have it ignore template rendering errors and continue on running. I think that change would handle this as well. As adding a config option for this is a feature, I'm categorizing this as an enhancement request.
Thanks, I didn't see that other issue. I don't mind if you want to close this one as a dup. Though I think this one is more succinct and so might be easier for others to find.
phemmer
changed the title
Template errors are fatal
Template errors should not be fatal
Oct 29, 2020
Consul Template version
consul-template v0.25.1 (b11fa80)
Configuration
Command
Debug output
Expected behavior
Should log and error and continue.
Actual behavior
Exits with error message
Steps to reproduce
123
to123abc
References
Additional info
The documentation clearly states:
In this case the optional command is not used, so consul-template should not exit. It should log an error and continue running.
This is especially problematic if consul-template is handling multiple templates. An error in a single template should not cause all other templates to stop rendering.
The text was updated successfully, but these errors were encountered: