Merge lp:~therve/pyjuju/subordinates-relation-check into lp:pyjuju

Proposed by Thomas Herve
Status: Merged
Approved by: Kapil Thangavelu
Approved revision: 619
Merged at revision: 619
Proposed branch: lp:~therve/pyjuju/subordinates-relation-check
Merge into: lp:pyjuju
Diff against target: 32 lines (+6/-3)
2 files modified
juju/state/tests/test_relation.py (+3/-0)
juju/state/topology.py (+3/-3)
To merge this branch: bzr merge lp:~therve/pyjuju/subordinates-relation-check
Reviewer Review Type Date Requested Status
Kapil Thangavelu (community) Approve
Review via email: mp+151047@code.launchpad.net

Description of the change

Only allow one subordinate relations between svcs

It seems to be that topology.has_relation_between_endpoints didn't check for
subordinates properly.

To post a comment you must log in.
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

looks good, thanks!

review: Approve
Revision history for this message
Kapil Thangavelu (hazmat) wrote :

*** Submitted:

Only allow one subordinate relations between svcs

It seems to be that topology.has_relation_between_endpoints didn't check for
subordinates properly.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'juju/state/tests/test_relation.py'
2--- juju/state/tests/test_relation.py 2012-09-10 03:20:20 +0000
3+++ juju/state/tests/test_relation.py 2013-02-28 16:33:46 +0000
4@@ -865,6 +865,9 @@
5 "contents": {"private-address": None}},
6 "unit-0000000002": {
7 "contents": {"private-address": None}}}}})
8+ topology = yield self.get_topology()
9+ self.assertTrue(
10+ topology.has_relation_between_endpoints([mysql_ep, logging_ep]))
11
12 @inlineCallbacks
13 def test_presence_node_is_ephemeral(self):
14
15=== modified file 'juju/state/topology.py'
16--- juju/state/topology.py 2012-09-15 19:24:00 +0000
17+++ juju/state/topology.py 2013-02-28 16:33:46 +0000
18@@ -544,11 +544,11 @@
19 for relation_data in relations.itervalues():
20 scope = relation_data["scope"]
21 services = relation_data["services"]
22+
23 for endpoint in endpoints:
24 service = services.get(service_ids[endpoint])
25- if not service or service["name"] != \
26- endpoint.relation_name or \
27- scope != endpoint.relation_scope:
28+ if (not service or service["name"] != endpoint.relation_name or
29+ scope not in (endpoint.relation_scope, "container")):
30 break
31 else:
32 return True

Subscribers

People subscribed via source and target branches

to status/vote changes: