peer relation without public interface

Merlijn Sebrechts merlijn.sebrechts at gmail.com
Thu Jan 12 20:17:32 UTC 2017


Hi Tilman


I think it's best that you create your own interface layer to do this. Then
include that interface layer in `layer.yaml` and the hooks should be
created at build time.

More info on developing interface layers:
https://jujucharms.com/docs/2.0/developer-layers-interfaces#writing-an-interface-layer



Regards
Merlijn



2017-01-11 14:23 GMT+01:00 Tilman Baumann <tilman.baumann at canonical.com>:

> Hi,
>
> I'm writing a layered reactive-python charm which uses a peer relation
> to know all units of the same application.
>
> However I don't seem to find a way to convince charm build to create the
> ./hook/ files for this relation for me.
>
> If I do my metadata.yaml like this and include the interface in
> layers.yaml then I get the hook files and the interface layer code gets
> pulled in.
> metadata.yaml
> peers:
>   foobar:
>     interface: ceph
>
>
> If I don't specify a interface or use my own name, then the hooks won't
> be created. So my @hook handlers in the reactive code never see it.
>
> What is the general best practice for providing peer relations of a own
> type in a layered charm?
>
> I suppose there is no reason why I can't put the code in a class based
> off RelationBase like interface layers usually do? The code entry point
> seems to the @hook decorators around the methods. I don't need to create
> instances or anything like that, right?
>
> Cheers and Thanks
>  Tilman
>
> --
> Juju mailing list
> Juju at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/
> mailman/listinfo/juju
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20170112/67117589/attachment.html>


More information about the Juju mailing list