hashicorp / hashicorp/consul-template

The same template content but with different destinations outputed only once

Open
#1,719 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
4.8k
Forks
801
Avg merge
4h 5m
Merged PRs (30d)
6

Description

I have following two template files:
```
template.1
template.2
```
Both have the same content:
```
cat template.1
> aaa
cat template.2
> aaa
```
I run command:
```
./consul-template -template "./template.1:./template.1.out" -template "./template.2:./template.2.out" -once
```
As a result of this i receive one output file:
```
cat template.1.out
> aaa
```

Although i understand that template is resolved exactly once because it is basically the same but i expect it to be outputed into two destinations

If i remove "-once" arg from commandline than template is outputed as i expetcted into two destinations but as a consequence of this consul template process does not end and exit after templates resolving.

So i need both:
- outputing templates to each defined locations (even if they have the same content)
- exiting process after templates resolving

How to achive this? Is this a bug or intended behavior? And if intended behavior then may i ask for improvement and adding some additional mode or arg that will cause consul template to work as described above?

Contributor guide

Open the contributing guide

Research direction

Reproduce the two-template command with and without -once, using the template files and destinations shown in the issue. Trace the -once command-line handling and rendering flow to determine why identical content is emitted once; done means both output files are written and the process exits after rendering.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.