Haproxy: add support for track in wait_until_status (#53677)

When haproxy is configured to track the status of a server using a
server in another backend it will not report all status as expected.
Using substring matching will solve this.

The CSV will output the server status in the following way:
MAINT: MAINT (via pxname/svname)
UP: UP
DOWN: DOWN

Haproxy doc on trach: https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#5.2-track
pull/53677/merge
Jonas Esbjørn Engell 6 years ago committed by ansibot
parent 5ba7063f4f
commit f9b812a982

@ -353,8 +353,9 @@ class HAProxy(object):
state = self.get_state_for(pxname, svname)
# We can assume there will only be 1 element in state because both svname and pxname are always set when we get here
if state[0]['status'] == status:
if not self._drain or (state[0]['scur'] == '0' and state == 'MAINT'):
# When using track we get a status like this: MAINT (via pxname/svname) so we need to do substring matching
if status in state[0]['status']:
if not self._drain or (state[0]['scur'] == '0' and 'MAINT' in state):
return True
else:
time.sleep(self.wait_interval)

Loading…
Cancel
Save