romana / core

Romana core components - Micro services written in Go.
Apache License 2.0
47 stars 11 forks source link

Topology not providing agent_port when querying /hosts #28

Open cgilmour opened 8 years ago

cgilmour commented 8 years ago

Agent port is zero for all hosts when doing this:

ubuntu@ip-192-168-0-10:~$ curl -s -f -H "Content-Type: application/json" http://192.168.0.10:9603/hosts
[{"id":"1","name":"ip-192-168-0-10","ip":"192.168.0.10","romana_ip":"10.0.0.0/16","agent_port":0,"links":null},{"id":"2","name":"ip-192-168-0-11","ip":"192.168.0.11","romana_ip":"10.1.0.0/16","agent_port":0,"links":null},{"id":"3","name":"ip-192-168-0-12","ip":"192.168.0.12","romana_ip":"10.2.0.0/16","agent_port":0,"links":null},{"id":"4","name":"ip-192-168-0-13","ip":"192.168.0.13","romana_ip":"10.3.0.0/16","agent_port":0,"links":null},{"id":"5","name":"ip-192-168-0-14","ip":"192.168.0.14","romana_ip":"10.4.0.0/16","agent_port":0,"links":null}]

But when checking a specific host, the correct number is provided.

ubuntu@ip-192-168-0-10:~$ curl -s -f -H "Content-Type: application/json" http://192.168.0.10:9603/hosts/1
{"id":"1","name":"ip-192-168-0-10","ip":"192.168.0.10","romana_ip":"10.0.0.0/16","agent_port":9604,"links":[{"Href":"http://192.168.0.10:9604","Rel":"agent"},{"Href":"/hosts/1","Rel":"self"},{"Href":"/hosts","Rel":"self"}]}ubuntu@ip-192-168-0-10:~$ 

This was affecting my 'romana' script, since it parses the output of /hosts query. I can change it to use /hosts/{id} instead.