Merge lp://staging/~dpb/charms/precise/haproxy/fix-service-entries into lp://staging/charms/haproxy
Proposed by
David Britton
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 75 | ||||
Proposed branch: | lp://staging/~dpb/charms/precise/haproxy/fix-service-entries | ||||
Merge into: | lp://staging/charms/haproxy | ||||
Diff against target: |
186 lines (+75/-25) 3 files modified
hooks/hooks.py (+26/-20) hooks/tests/test_peer_hooks.py (+2/-2) hooks/tests/test_reverseproxy_hooks.py (+47/-3) |
||||
To merge this branch: | bzr merge lp://staging/~dpb/charms/precise/haproxy/fix-service-entries | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Ceppi (community) | Approve | ||
Sidnei da Silva (community) | Approve | ||
Review via email:
|
Description of the change
When using "relation-
This change includes unit test cases that expose and fix the problem.
To post a comment you must log in.
Hi David, thanks for the branch. A few comments below.
43 + service = {}
44 + # First come, first serve, make sure all options other than
45 + # "servers" are represented in the combined dict
46 + for key in old_service.keys():
47 + service[key] = old_service[key]
This can be rewritten as:
service = old_service.copy()
56 + service["servers"] = old_servers + new_servers
This doesn't account for duplicate server entries. I would deduplicate on (ip, port). The trick is if options differ for two definitions of the same (ip, port) combination, what to do so it's deterministic. Maybe sort on the whole tuple contents and pick first?