Skip to content
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

-parse-only flag ignored for some template functions #1978

Open
slabstone opened this issue Aug 23, 2024 · 1 comment
Open

-parse-only flag ignored for some template functions #1978

slabstone opened this issue Aug 23, 2024 · 1 comment

Comments

@slabstone
Copy link

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 slabstone changed the title -parse-only flag ignored for some templates -parse-only flag ignored for some template functions Aug 23, 2024
@ncode
Copy link

ncode commented Oct 9, 2024

I've also noticed that with the command block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants