cabrinoob / rancher-registrator

A registrator-like made for Consul & Rancher
15 stars 16 forks source link

fix typo and handle ports being null from api #5

Closed makeacode closed 7 years ago

makeacode commented 7 years ago

upgraded to 1.5.1 yesterday and noticed that services don't get unregistered because the call to checkForPortMapping fails. I think this should fix it unless there's a better way.

makeacode commented 7 years ago

Output from 1.4.1:

{ "create_index": null, "dns": [], "dns_search": [], "environment_uuid": "adminProject", "external_id": "f1994b0e1eae9409e00d3e53a812c73c9bd3882325081f1c252461543d01983f", "health_check_hosts": [], "health_state": null, "host_uuid": "82ecb960-9ec5-4572-adae-be1d89975099", "hostname": null, "ips": [ "10.7.0.23" ], "labels": { "io.rancher.container.system": "rancher-agent" }, "links": {}, "memory_reservation": 0, "milli_cpu_reservation": null, "name": "rancher-agent", "network_from_container_uuid": null, "network_uuid": "2396aa27-c8f3-4966-8a94-70b8124d4d67", "ports": [], "primary_ip": "10.7.0.23", "primary_mac_address": "02:2f:b1:f3:71:52", "service_index": null, "service_name": null, "stack_name": null, "stack_uuid": null, "start_count": 1, "state": "running", "system": false, "uuid": "fe697874-77ca-4a7c-bc7b-b8487e1946ed" }

Output from 1.5.1:

{ "create_index": null, "dns": [], "dns_search": [], "environment_uuid": "adminProject", "external_id": "314932afb471d95747d793ad0126e7439c9e7645be21635352143e10aea28537", "health_check_hosts": [], "health_state": null, "host_uuid": "064ca8f4-82bf-4183-8409-19260c458b3c", "hostname": null, "ips": [ "10.7.0.24" ], "labels": { "io.rancher.container.system": "rancher-agent" }, "links": null, "memory_reservation": 0, "metadata_kind": "container", "milli_cpu_reservation": null, "name": "rancher-agent", "network_from_container_uuid": null, "network_uuid": "a78c98c0-7f79-4d7e-8cb6-aaa814b3cd48", "ports": null, "primary_ip": "10.7.0.24", "primary_mac_address": "02:a7:b3:a5:e1:e6", "service_index": null, "service_name": null, "stack_name": null, "stack_uuid": null, "start_count": 1, "state": "running", "system": false, "uuid": "cb2b6571-d350-48ba-8bc9-26f20991826b" },