Closed C0reFast closed 6 years ago
Admittedly the JSON generated by the module isn't strictly valid, but - in my tests, at least - HCL doesn't necessarily care.
See the note here: https://github.com/claranet/puppet-consul_template/blob/9583592d1860017cb043810f1c858bd473b56a0c/manifests/watch.pp#L54-L55
Does consul-template
itself have any issue with the config generated by the module?
in my case, the consul-template logs a warning: "2017/12/18 10:20:25 [WARN] consul now accepts a stanza instead of a string. Update your configuration files and change consul = "" to consul { } instead.", and didn't generate the nginx config file. and the consul-template version is "consul-template v0.19.4 (68b1da2)"
Thanks for reporting this - there was indeed a bug in the module.
I've backported the fix into version 1.0.1 of the module (the last to support Puppet 3) - I'll close this issue as fixed for now, but please feel free to re-open if the problem still exists using the latest Forge release.
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
What are you seeing
the config.json will be:
the first line is closed by '}', the config is not a valid json
What behaviour did you expect instead
when add "pretty_config => true" to class { '::consul_template':,the config is valid。
Output log
Any additional information you'd like to impart
I think this line:https://github.com/claranet/puppet-consul_template/blob/master/manifests/config.pp#L13 case the problem, when pretty_config is set to false, the main config json is not end with "\n}\n$", so the code 'regsubst($content_full, "\n}\n$", '')' didn't strip the '}', this make config format error