mesosphere/marathon — pull request #893 by mikljohansson (2014-12-16 13:23:20+00:00)
Title: Fixed problems in haproxy-marathon-bridge script.

* Fixed "unbound local variable" for services which have neither servicePort nor active tasks. Previosuly any service without servicePort/tasks would terminate the script so that no other services were configured either.
* Fixed problem with IP-address being used as port in HAproxy for services without a servicePort. Fix skips services for which Marathon doesn't return a servicePort. Previously it would generate odd entries like

```
listen myproduct_myapp-10.1.2.3
bind 0.0.0.0:10.1.2.3
mode tcp
option tcplog
balance leastconn
```

Example output from Marathon in my case would look something like

```
core@ip-10-1-2-3 ~ $ curl -sSfLk -m 10 -H 'Accept: text/plain' http://10.1.2.3:8080/v2/tasks
myproduct_myapp1
myproduct_myapp2 10.1.2.3 10.1.2.4
myproduct_myapp3 4040 10.1.2.3:31006
```

Where *myproduct_myapp1* would cause a script exit with "unbound local variable" and *myproduct_myapp2* would get a the IP-address as the HAproxy port.