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
=== modified file 'juju/state/tests/test_relation.py'
--- juju/state/tests/test_relation.py 2012-09-10 03:20:20 +0000
+++ juju/state/tests/test_relation.py 2013-02-28 16:33:46 +0000
@@ -865,6 +865,9 @@
865 "contents": {"private-address": None}},865 "contents": {"private-address": None}},
866 "unit-0000000002": {866 "unit-0000000002": {
867 "contents": {"private-address": None}}}}})867 "contents": {"private-address": None}}}}})
868 topology = yield self.get_topology()
869 self.assertTrue(
870 topology.has_relation_between_endpoints([mysql_ep, logging_ep]))
868871
869 @inlineCallbacks872 @inlineCallbacks
870 def test_presence_node_is_ephemeral(self):873 def test_presence_node_is_ephemeral(self):
871874
=== modified file 'juju/state/topology.py'
--- juju/state/topology.py 2012-09-15 19:24:00 +0000
+++ juju/state/topology.py 2013-02-28 16:33:46 +0000
@@ -544,11 +544,11 @@
544 for relation_data in relations.itervalues():544 for relation_data in relations.itervalues():
545 scope = relation_data["scope"]545 scope = relation_data["scope"]
546 services = relation_data["services"]546 services = relation_data["services"]
547
547 for endpoint in endpoints:548 for endpoint in endpoints:
548 service = services.get(service_ids[endpoint])549 service = services.get(service_ids[endpoint])
549 if not service or service["name"] != \550 if (not service or service["name"] != endpoint.relation_name or
550 endpoint.relation_name or \551 scope not in (endpoint.relation_scope, "container")):
551 scope != endpoint.relation_scope:
552 break552 break
553 else:553 else:
554 return True554 return True

Subscribers

People subscribed via source and target branches

to status/vote changes: