consul-template icon indicating copy to clipboard operation
consul-template copied to clipboard

-parse-only flag ignored for some template functions

Open slabstone opened this issue 1 year ago • 1 comments

Consul Template version

consul-template v0.39.1 (cc8f954)

Configuration

Hello, World!
Current time: {{ timestamp }}
Bye!

Command

consul-template -template 'test.ctmpl' -parse-only

Debug output

2024-08-23T17:51:06.481+0400 [INFO] consul-template v0.39.1 (cc8f954)
2024-08-23T17:51:06.481+0400 [INFO] (runner) creating new runner (dry: false, once: false)
2024-08-23T17:51:06.481+0400 [DEBUG] (watcher) adding vault.token
2024-08-23T17:51:06.481+0400 [TRACE] (watcher) vault.token starting
2024-08-23T17:51:06.481+0400 [TRACE] (view) vault.token starting fetch
2024-08-23T17:51:06.481+0400 [TRACE] vault.token: starting renewer
2024-08-23T17:51:06.481+0400 [DEBUG] (runner) final config: [REDACTED]
2024-08-23T17:51:06.481+0400 [INFO] (runner) creating watcher
2024-08-23T17:51:06.483+0400 [INFO] (runner) starting
2024-08-23T17:51:06.483+0400 [DEBUG] (runner) running initial templates
2024-08-23T17:51:06.483+0400 [DEBUG] (runner) initiating run
2024-08-23T17:51:06.483+0400 [DEBUG] (runner) checking template 1c88fa6d04efb64cc8ce4b8aae2824a1
2024-08-23T17:51:06.483+0400 [DEBUG] (runner) rendering "test.ctmpl" => ""
2024-08-23T17:51:06.483+0400 [ERR] (cli) error rendering "test.ctmpl" => "": failed writing file: missing destination

Expected behavior

No output, exit code 0

Actual behavior

What actually happened?

2024-08-23T17:52:54.206+0400 [ERR] (cli) error rendering "test.ctmpl" => "": failed writing file: missing destination

exit code 14

Steps to reproduce

  1. run consul-template with -parse-only with attached template as input and without specifiyng output file

Command

consul-template -template 'test.ctmpl:test.txt' -parse-only

Debug output

2024-08-23T17:58:08.429+0400 [INFO] consul-template v0.39.1 (cc8f954)
2024-08-23T17:58:08.429+0400 [INFO] (runner) creating new runner (dry: false, once: false)
2024-08-23T17:58:08.429+0400 [DEBUG] (watcher) adding vault.token
2024-08-23T17:58:08.429+0400 [TRACE] (watcher) vault.token starting
2024-08-23T17:58:08.430+0400 [TRACE] (view) vault.token starting fetch
2024-08-23T17:58:08.430+0400 [TRACE] vault.token: starting renewer
2024-08-23T17:58:08.430+0400 [DEBUG] (runner) final config: [REDACTED]
2024-08-23T17:58:08.430+0400 [INFO] (runner) creating watcher
2024-08-23T17:58:08.431+0400 [INFO] (runner) starting
2024-08-23T17:58:08.431+0400 [DEBUG] (runner) running initial templates
2024-08-23T17:58:08.431+0400 [DEBUG] (runner) initiating run
2024-08-23T17:58:08.431+0400 [DEBUG] (runner) checking template 1c88fa6d04efb64cc8ce4b8aae2824a1
2024-08-23T17:58:08.432+0400 [DEBUG] (runner) rendering "test.ctmpl" => "test.txt"
2024-08-23T17:58:08.436+0400 [INFO] (runner) rendered "test.ctmpl" => "test.txt"
2024-08-23T17:58:08.436+0400 [DEBUG] (runner) diffing and updating dependencies
2024-08-23T17:58:08.436+0400 [INFO] (runner) ParseOnly mode and all templates parsed
2024-08-23T17:58:08.436+0400 [INFO] (runner) stopping
2024-08-23T17:58:08.436+0400 [DEBUG] (runner) stopping watcher
2024-08-23T17:58:08.436+0400 [DEBUG] (watcher) stopping all views
2024-08-23T17:58:08.436+0400 [DEBUG] (runner) stopping vault token watcher
2024-08-23T17:58:08.436+0400 [DEBUG] (watcher) stopping all views
2024-08-23T17:58:08.436+0400 [TRACE] (watcher) stopping vault.token

Expected behavior

No output, exit code 0, file test.txt is not created

Actual behavior

What actually happened?

No output, exit code 0, file test.txt is created

Steps to reproduce

  1. run consul-template with -parse-only with attached template as input and with output file specified

slabstone avatar Aug 23 '24 14:08 slabstone

I've also noticed that with the command block.

ncode avatar Oct 09 '24 07:10 ncode