Merge lp://qastaging/~lomov-as/charm-helpers/cloud-foundry-multiple-units-in-relation-context into lp://qastaging/~cf-charmers/charm-helpers/cloud-foundry

Proposed by Alex Lomov
Status: Needs review
Proposed branch: lp://qastaging/~lomov-as/charm-helpers/cloud-foundry-multiple-units-in-relation-context
Merge into: lp://qastaging/~cf-charmers/charm-helpers/cloud-foundry
Diff against target: 114 lines (+48/-11)
3 files modified
.bzrignore (+2/-1)
charmhelpers/core/templating.py (+11/-4)
tests/core/test_templating.py (+35/-6)
To merge this branch: bzr merge lp://qastaging/~lomov-as/charm-helpers/cloud-foundry-multiple-units-in-relation-context
Reviewer Review Type Date Requested Status
Cloud Foundry Charmers Pending
Review via email: mp+220508@code.qastaging.launchpad.net

Description of the change

multiple units processing for relation context

As far as we moved relation context to core.templating we need to care about possobility to connect multimple units. Geting information from several units will be useful for etcd and cf-loggregator charms.

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

The idea here is fine. I'd suggest that this is a different context type as it implies a different relationship to the template is manages however. Any consumer/template needs to be prepared to iterate a list.

Maybe a subclass called RelationListContext which sets multiple units to True and the base class doesn't expose a way to change this directly, set to False in the class. That way we share the implmentation but it is explicit to the template what they will be consuming.

Revision history for this message
Alex Lomov (lomov-as) wrote :

I thought about making distinct class ( something like
RelationUnitListContext ), but this idea didn't suits me because having
list of units with their own properties is something that stands behind
juju relations. In this case I would like to see this functionality inside
RelationContext. What do you think?

On 22 May 2014 04:06, Benjamin Saller <email address hidden> wrote:

> The idea here is fine. I'd suggest that this is a different context type
> as it implies a different relationship to the template is manages however.
> Any consumer/template needs to be prepared to iterate a list.
>
> Maybe a subclass called RelationListContext which sets multiple units to
> True and the base class doesn't expose a way to change this directly, set
> to False in the class. That way we share the implmentation but it is
> explicit to the template what they will be consuming.
>
>
> --
>
> https://code.launchpad.net/~lomov-as/charm-helpers/cloud-foundry-multiple-units-in-relation-context/+merge/220508
> You are the owner of
> lp:~lomov-as/charm-helpers/cloud-foundry-multiple-units-in-relation-context.
>

Revision history for this message
Benjamin Saller (bcsaller) wrote :

> I thought about making distinct class ( something like
> RelationUnitListContext ), but this idea didn't suits me because having
> list of units with their own properties is something that stands behind
> juju relations. In this case I would like to see this functionality inside
> RelationContext. What do you think?
>

My agument is the same, that while the List subclass can share the implementation with the parent they present a suitably different interface to the consuming template. Templates written to this type of relation must use iteration over a list and these methods will always return a list of values even if there is only 1. To me this seems sufficently different to warrent some clear indication in the declartive part of template configuration.

>
> On 22 May 2014 04:06, Benjamin Saller <email address hidden> wrote:
>
> > The idea here is fine. I'd suggest that this is a different context type
> > as it implies a different relationship to the template is manages however.
> > Any consumer/template needs to be prepared to iterate a list.
> >
> > Maybe a subclass called RelationListContext which sets multiple units to
> > True and the base class doesn't expose a way to change this directly, set
> > to False in the class. That way we share the implmentation but it is
> > explicit to the template what they will be consuming.
> >
> >
> > --
> >
> > https://code.launchpad.net/~lomov-as/charm-helpers/cloud-foundry-multiple-
> units-in-relation-context/+merge/220508
> > You are the owner of
> > lp:~lomov-as/charm-helpers/cloud-foundry-multiple-units-in-relation-context.
> >

Unmerged revisions

183. By Alex Lomov

multiple units functional for relation context

182. By Alex Lomov

RelationalContext: fix issue with interfaces that have dash in the name

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