2017-01-19 12 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引数なしで呼び出された場合は、その後、現在のエージェント のノードが返され

を言いました。

助けが必要ですか?

答えて

関連する問題