hashicorp / hashicorp/consul-template
-parse-only flag ignored for some template functions
- Dominant language
- Go
- Stars
- 4.8k
- Forks
- 801
- Avg merge
- 4h 5m
- Merged PRs (30d)
- 6
Description
### Consul Template version
```
consul-template v0.39.1 (cc8f954)
```
### Configuration
```liquid
Hello, World!
Current time: {{ timestamp }}
Bye!
```
### Command
```shell
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
```shell
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
Contributor guide
Assessment
This issue has not been assessed yet.