Merge lp://staging/~hazmat/pyjuju/status-w-peers into lp://staging/pyjuju

Proposed by Kapil Thangavelu
Status: Merged
Approved by: Gustavo Niemeyer
Approved revision: 264
Merged at revision: 265
Proposed branch: lp://staging/~hazmat/pyjuju/status-w-peers
Merge into: lp://staging/pyjuju
Diff against target: 147 lines (+61/-10)
2 files modified
ensemble/control/status.py (+10/-5)
ensemble/control/tests/test_status.py (+51/-5)
To merge this branch: bzr merge lp://staging/~hazmat/pyjuju/status-w-peers
Reviewer Review Type Date Requested Status
Gustavo Niemeyer Approve
Review via email: mp+66618@code.staging.launchpad.net

Description of the change

Fixes ensemble status to work with peer relations.

To post a comment you must log in.
Revision history for this message
Benjamin Saller (bcsaller) wrote :

[1]

        for relation in relations:
            rel_services = yield relation.get_service_states()
            # filter out 'self' if its nots a peer relation
            if len(rel_services) > 1:
                rel_services = [
                    rsn for rsn in rel_services if rsn.service_name !=
                    service.service_name]
            if len(rel_services) > 1:
                raise ValueError("Unexpected relationship with more "
                                 "than 2 endpoints")

This does fix it, I'd like to expand the comment such that its a bit more obvious whats happening there. To be clear this is my fault not yours, but a series of len(x) > 1 checks don't really related to how that handles peer relations or not. Something like:

# Singular rel_services imply a peer relation. Two rel_services imply a provides/requires relationship. In the later case we omit the local size of the relation in reporting.

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Looks good, thanks!

[1]

22 + rel_services = [
23 + rsn for rsn in rel_services if rsn.service_name !=
24 + service.service_name]

The way this is formatted feels more unreadable than it ought to be.

Here is a suggested style:

                rel_services = [rsn for rsn in rel_services
                                if rsn.service_name != service.service_name]

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: