hashicorp / hashicorp/consul-template
can't evaluate field Node in type *dependency.Node
- Dominant language
- Go
- Stars
- 4.8k
- Forks
- 801
- Avg merge
- 4h 5m
- Merged PRs (30d)
- 6
Description
consul-template v0.20.0 (b709612c)
### Configuration
```liquid
{{ with node -}}
node:
id: {{ .Node.Node }}
{{- range .Services }}
{{ .Tags }}
{{- end -}}
{{ end }}
~
```
### Command
```shell
consul-template -template 'test.template:test.txt' -once -log-level trace
```
### Expected behavior
Some fault tolerance logic, restart, etc
### Actual behavior
> 2019/08/13 06:16:17.371648 [WARN] (view) catalog.node: Unexpected response code: 500 (No known Consul servers) (retry attempt 1 after "250ms")
> 2019/08/13 06:16:17.629392 [WARN] (view) catalog.node: Unexpected response code: 500 (No known Consul servers) (retry attempt 2 after "500ms")
> 2019/08/13 06:16:18.132668 [WARN] (view) catalog.node: Unexpected response code: 500 (No known Consul servers) (retry attempt 3 after "1s")
> 2019/08/13 06:16:19.137675 [WARN] (view) catalog.node: Unexpected response code: 500 (No known Consul servers) (retry attempt 4 after "2s")
> 2019/08/13 06:16:21.144354 [WARN] catalog.node: no node exists with the name ""
> 2019/08/11 07:44:01.325185 [ERR] (cli) /opt/xds/services.csv.gotemplate: execute: template: :2:21: executing "" at <.Node.Node>: can't evaluate field Node in type *dependency.Node
### Steps to reproduce
1. Stop agent
2. Immediately run consul-template command
I was only able to reproduce this by stopping the agent, but it also happens otherwise, such as before a quorum is ready etc.
Contributor guide
Research direction
Start with the supplied consul-template -template ... -once command and the {{ with node }} template, reproducing the failure while the Consul agent is stopped. Trace the catalog.node handling around unavailable servers and define the intended recovery behavior; done should avoid the template evaluation error and include coverage for this reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100