How to count relations?
alex.kavanagh at canonical.com
Wed Jun 7 15:38:30 UTC 2017
I'm assuming you are using charms.reactive; if not then look into
In your interface, count the number of conversations that have a scope set
to something other than None. scope shouldn't be None, but I've had cases
where it has been (it may have been a bug):
So in the provider.py RelationBase derived class, something along the lines
num = len([c for c in self.conversations() if c.scope])
in a method would be a relatively simple way of doing it.
(There may be better ways of doing this!)
On Wed, Jun 7, 2017 at 4:22 PM, fengxia <fxia1 at lenovo.com> wrote:
> Hi Juju,
> I'm building two charms and linking them with one relation, one charm
> ("A") will provide and the other ("B") will require.
> The deployment will have one "A" and three "B"s. How do I know all three
> Bs have joined? I'm thinking to use a counter in A's relation, then at
> relation-joined hook by B to add this counter. But set_remote() and
> set_local() didn't work. Not sure what's the right way to achieve this?
> Feng xia
> Lenovo USA
> Phone: 5088011794
> fxia1 at lenovo.com
> Twitter | Facebook | Instagram | Blogs | Forums
> Juju mailing list
> Juju at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailm
Alex Kavanagh - Software Engineer
Cloud Dev Ops - Solutions & Product Engineering - Canonical Ltd
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Juju