need a `nomad-template` cli like `consul-template`
- Dominant language
- Go
- Stars
- 17k
- Forks
- 2.1k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 105
Description
### Proposal
I think there should be a way to render the "template" from the `template` stanza of **Nomad** using the cmd line on the target machine.
This would be useful during debugging.
It would be fine if it was a command/subcommand of the nomad binary as well.
### Use-cases
I had the following `template` in a Nomad job:
```bash
SOME_VAR="-Xms[[ env "attr.memory.totalbytes" | parseUint | divide 1048576 | multiply 0.60 | minimum 15360 | printf "%.0f" ]]m ...
```
I was trying to get 60% of total memory and use the minimum of _**that**_ and 15GB.
This worked fine for smaller sized machines, where the 60% was less than 15360m
For a machine with large memory, it failed with:
```
Invalid initial heap size: -Xms%!f(int64=15360)m
```
The message is very cryptic and the only clue being the `%!f`.
_What made it work was making `15360` to `15360.0` for the subsequent "float print"._
I wish there was a Nomad way to test this, using a cli tool like `consul-template`.
Typically I test consul specific templates using `consul-template` to figure out their accuracy, especially around newlines and spaces, etc.
### Attempted Solutions
None
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the Nomad template stanza and the nomad binary's CLI entry points, then compare the requested workflow with consul-template. Done means users can render and inspect a Nomad template from the target machine through a documented command or subcommand, including output that helps diagnose formatting issues.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100