Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
haproxy: Fix compatibility when map is actually imap. (#3350)
Browse files Browse the repository at this point in the history
While I still have no idea why or how the `map` call is being swapped out while still running in python 2.7, this change will fix the following error, as well as improve py3 compatibility.
  • Loading branch information
christophebiocca authored and resmo committed Nov 9, 2016
1 parent f941dbd commit b23740e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions network/haproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def discover_all_backends(self):
"""
data = self.execute('show stat', 200, False).lstrip('# ')
r = csv.DictReader(data.splitlines())
return map(lambda d: d['pxname'], filter(lambda d: d['svname'] == 'BACKEND', r))
return tuple(map(lambda d: d['pxname'], filter(lambda d: d['svname'] == 'BACKEND', r)))


def execute_for_backends(self, cmd, pxname, svname, wait_for_status = None):
Expand Down Expand Up @@ -244,7 +244,7 @@ def get_state_for(self, pxname, svname):
"""
data = self.execute('show stat', 200, False).lstrip('# ')
r = csv.DictReader(data.splitlines())
state = map(lambda d: { 'status': d['status'], 'weight': d['weight'] }, filter(lambda d: (pxname is None or d['pxname'] == pxname) and d['svname'] == svname, r))
state = tuple(map(lambda d: { 'status': d['status'], 'weight': d['weight'] }, filter(lambda d: (pxname is None or d['pxname'] == pxname) and d['svname'] == svname, r)))
return state or None


Expand Down

0 comments on commit b23740e

Please sign in to comment.