mesosphere / marathon-lb

Marathon-lb is a service discovery & load balancing tool for DC/OS
Apache License 2.0
449 stars 300 forks source link

Error in marathon_lb.py #428

Closed Jugulaire closed 5 years ago

Jugulaire commented 7 years ago

Hi,

When i try to run the script for installing HAproxy on marathon i got this error :

root@marathon-master:/home/jugu/marathon-lb# ./marathon_lb.py --marathon http://localhost:8080 --haproxy-config /etc/haproxy/haproxy.cfg --group external marathon-lb: fetching apps marathon-lb: GET http://localhost:8080/v2/apps?embed=apps.tasks marathon-lb: got apps ['/web'] Traceback (most recent call last): File "./marathon_lb.py", line 1161, in <module> regenerate_config(get_apps(marathon), args.haproxy_config, args.group, File "./marathon_lb.py", line 876, in get_apps appId, servicePort, get_health_check(app, i)) File "./marathon_lb.py", line 850, in get_health_check if check['portIndex'] == portIndex: KeyError: 'portIndex' I would like to know why because my marathon and mesos are running perfectly.

brndnmtthws commented 7 years ago

Which version of MLB is that? It looks a bit like #62 which was fixed a long time ago.

Regardless, it seems like you're running MLB in an unsupported configuration. What version of Marathon are you using?

Jugulaire commented 7 years ago

I use the latest version, freshly downloaded on the website of mesosphere. I've cloned the latest version of MLB too.

gpaul commented 7 years ago

That seems to suggest you have specified a healthCheck for your app (presumably '/web') that specifies neither a port, nor a portIndex. The code on line https://github.com/mesosphere/marathon-lb/blob/master/marathon_lb.py#L1211 does not provide a default value to get so it will raise a KeyError if the key is not present.

What do you see when you hit http://localhost:8080/v2/apps?embed=apps.tasks manually?

brndnmtthws commented 7 years ago

Which version of Marathon?

jkoelker commented 5 years ago

Hi, since its been a while, I'm going to close this issue for now. If its still an issue with the latest marathon/marathon-lb, please update this issue.