2017-01-19 11 views
0

내 영사 템플릿 버전 :영사 템플리트 {{node}} 기본값 사용 안함?

# ./consul-template -v 

consul-template v0.18.0-rc2 (652183d) 

내가 테스트 노드 아래의 템플릿을 사용하려고 :

{{with node}}{{.Node.Node}} ({{.Node.Address}}){{range .Services}} 
    {{.Service}} {{.Port}} ({{.Tags | join ","}}){{end}} 
{{end}} 

내가 쉘을 실행
./consul-template -log-level debug -once -consul-addr consul-agent:9500 -template "/home/data/consul/templates/test1.tmpl:/home/data/consul/results/test1" 

그러나 그 이후

, TEST1 결과가 없습니다. 출력 디버그 정보 같은 아래 보이는 쉘은 영원히 대기 :

2017/01/19 03:17:29.283638 [INFO] consul-template v0.18.0-rc2 (652183d) 
2017/01/19 03:17:29.283660 [INFO] (runner) creating new runner (dry: false, once: true) 
2017/01/19 03:17:29.284061 [DEBUG] (runner) final config: {"Consul":{"Address":"consul-agent:9500","Auth":{"Enabled":false,"Username":"","Password":""},"Retry":{"Attempts":5,"Backoff":250000000,"Enabled":true},"SSL":{"CaCert":"","CaPath":"","Cert":"","Enabled":false,"Key":"","ServerName":"","Verify":true},"Token":""},"Dedup":{"Enabled":false,"MaxStale":2000000000,"Prefix":"consul-template/dedup/","TTL":15000000000},"Exec":{"Command":"","Enabled":false,"Env":{"Blacklist":null,"Custom":null,"Pristine":false,"Whitelist":null},"KillSignal":2,"KillTimeout":30000000000,"ReloadSignal":null,"Splay":0,"Timeout":0},"KillSignal":2,"LogLevel":"debug","MaxStale":2000000000,"PidFile":"","ReloadSignal":1,"Syslog":{"Enabled":false,"Facility":"LOCAL0"},"Templates":[{"Backup":false,"Command":"","CommandTimeout":30000000000,"Contents":"","Destination":"/home/data/consul/results/test1","Exec":{"Command":"","Enabled":false,"Env":{"Blacklist":[],"Custom":[],"Pristine":false,"Whitelist":[]},"KillSignal":2,"KillTimeout":30000000000,"ReloadSignal":null,"Splay":0,"Timeout":30000000000},"Perms":420,"Source":"/home/data/consul/templates/test1.tmpl","Wait":{"Enabled":false,"Min":0,"Max":0},"LeftDelim":"","RightDelim":""}],"Vault":{"Address":"","Enabled":false,"RenewToken":true,"Retry":{"Attempts":5,"Backoff":250000000,"Enabled":true},"SSL":{"CaCert":"","CaPath":"","Cert":"","Enabled":true,"Key":"","ServerName":"","Verify":true},"UnwrapToken":false},"Wait":{"Enabled":false,"Min":0,"Max":0}} 
2017/01/19 03:17:29.284113 [INFO] (runner) creating watcher 
2017/01/19 03:17:29.284311 [INFO] (runner) starting 
2017/01/19 03:17:29.284334 [DEBUG] (runner) running initial templates 
2017/01/19 03:17:29.284347 [INFO] (runner) initiating run 
2017/01/19 03:17:29.284394 [DEBUG] (runner) checking template b0b0ddfdf27b9ee0b190f139850272f6 
2017/01/19 03:17:29.284811 [DEBUG] (runner) was not watching 1 dependencies 
2017/01/19 03:17:29.284847 [DEBUG] (watcher) adding catalog.node 
2017/01/19 03:17:29.284869 [DEBUG] (runner) diffing and updating dependencies 
2017/01/19 03:17:29.284886 [DEBUG] (runner) watching 1 dependencies 
2017/01/19 03:17:29.288772 [INFO] (runner) initiating run 
2017/01/19 03:17:29.288796 [DEBUG] (runner) checking template b0b0ddfdf27b9ee0b190f139850272f6 
2017/01/19 03:17:29.289160 [DEBUG] (runner) missing data for 1 dependencies 
2017/01/19 03:17:29.289183 [DEBUG] (runner) diffing and updating dependencies 
2017/01/19 03:17:29.289197 [DEBUG] (runner) catalog.node(8c163f72e7ac) is still needed 
2017/01/19 03:17:29.289210 [DEBUG] (runner) watching 1 dependencies 

을하지만이 같은 템플릿을 변경하는 경우 :

{{with node "8c163f72e7ac"}}{{.Node.Node}} ({{.Node.Address}}){{range .Services}} 
    {{.Service}} {{.Port}} ({{.Tags | join ","}}){{end}} 
{{end}} 

그것은 잘 작동합니다! 노드 이름을 지정해야하는 이유는 무엇입니까? 다음 현재 에이전트 의 노드가 반환되는 인수없이 호출하면는 영사 - 템플릿 문서 https://github.com/hashicorp/consul-template#node에서는

말했다.

어떤 도움이 필요합니까?

답변