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
Please note that the Consul Template issue tracker is reserved
for bug reports and enhancements. For general usage questions,
please use the Consul mailing list:
# Copy-paste your Consul Template template here
{{ rangetree"db/nginx" }}{{ $ng_service := .Key }}{{ with $d := .Value | parseJSON }}{{ $network_type := $d.network_type }}{{ $ng_site := $d.ng_site }}{{ range $listeners := $d.listeners }}{{ $instance_name := $listeners.Instance_name}}{{ $vip := $listeners.CIDR}}{{ $listener_port := $listeners.listener_port }}{{ $cpu := $listeners.limit_cpu }}{{ range $rss := $d.rss }}{{ if $rss.enable | parseBool }}{{ $ip := $rss.ip }}{{ $port := $rss.port }}{{ with $hosts := $listeners.hosts }}
{{ $ng_service }}:{{ $hosts.master }}:{{ $hosts.slave }}:{{ $network_type }}:{{ $ng_site }}:{{ $instance_name }}:{{ $vip }}:{{ $listener_port }}:{{ $cpu }}:{{ $ip }}:{{ $port }}{{ end }}{{ end }}{{ end }}{{ end }}{{ end }}
{{ end }}
Command
# Place your Consul Template command here
the command always exit with 0
Debug output
2018/12/19 09:32:58.234332 [ERR] (cli) /pacloud/cdm/base/2.0/conf/db-specific/nginx.tmpl: execute: template: :1:75: executing "" at : error calling parseJSON: invalid character 's' after object key:value pair
Expected behavior
When there is a wrong json format data, the consul-template should skip this data instead of exiting.
And the other json data can still be processed。
What should I do to avoid consul-template launches when this happens?
Actual behavior
the consul-template dead
The text was updated successfully, but these errors were encountered:
I just ran into the same issue, namely: consul-template is crashing if the template contains a parseJSON function and the json data is corrupt. I could totally live with consul-template crashing on startup on corrupt json. But IMHO an already running instance should not crash, if one of the keys in consul is changed from correct to corrupt json. I think instead it should log the error and not rerender anything.
Please note that the Consul Template issue tracker is reserved
for bug reports and enhancements. For general usage questions,
please use the Consul mailing list:
Consul Template version
consul-template v0.19.0 (33b34b3)
Configuration
Command
Debug output
2018/12/19 09:32:58.234332 [ERR] (cli) /pacloud/cdm/base/2.0/conf/db-specific/nginx.tmpl: execute: template: :1:75: executing "" at : error calling parseJSON: invalid character 's' after object key:value pair
Expected behavior
When there is a wrong json format data, the consul-template should skip this data instead of exiting.
And the other json data can still be processed。
What should I do to avoid consul-template launches when this happens?
Actual behavior
the consul-template dead
The text was updated successfully, but these errors were encountered: