Code review comment for lp:~hazmat/pyjuju/status-w-peers

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.

« Back to merge proposal