Skip to content

Commit e10b1c2

Browse files
committed
Handle containers w/ no exposed ports in etcd template
1 parent 0f2987a commit e10b1c2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

templates/etcd.tmpl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11

22
#!/bin/bash
33

4-
54
{{range $key, $value := .}}
5+
{{ $addrLen := len $value.Addresses }}
6+
{{ if gt $addrLen 0 }}
67
{{ with $address := index $value.Addresses 0 }}
78
# {{ $value.Name }}
8-
curl -L http://127.0.0.1:4001/v2/keys/backends/{{ $value.Image.Repository}}/{{printf "%.*s" 12 $value.ID}} -XPUT -d value="{{ $address.IP }}:{{ $address.Port }}" -d ttl=15
9+
curl -XPUT -q -d value="{{ $address.IP }}:{{ $address.Port }}" -d ttl=15 http://127.0.0.1:4001/v2/keys/backends/{{ $value.Image.Repository}}/{{printf "%.*s" 12 $value.ID}}
910
{{ end }}
1011
{{end}}
12+
{{end}}

0 commit comments

Comments
 (0)