Re: Is base64 really the best way to use complex config values

2017-06-07 Thread James Hebden
Hi Tilman Just wanted to lend a +1 to this. Often config values also don't clearly call out that they are needing base64 data, or do not generate an error if non-compliant base64 is encountered. It's a layer of obfuscation that doesn't really add any benefit, unless binary data needed to be

Re: Does relation scopes need to match?

2017-06-07 Thread fengxia
Just to clarify my question. I know the official doc of these scopes, that data are broadcasted in GLOBAL and UNIT is maintained as 1-to-1. What I'd like to know is when we should use GLOBAL, and when to use UNIT? When I deploy multiple units of a charm, does it mean its end of relation must

Does relation scopes need to match?

2017-06-07 Thread fengxia
Hi Juju, I'm learning to write a relation. One thing that's puzzling to me is the scope. The question is, must provide and require use the same scope? For experiment, I have a scope.GLOBAL provide and scope.UNIT require. In deployment, there is one provide unit and three require units. In

Re: How to count relations?

2017-06-07 Thread Alex Kavanagh
On Wed, Jun 7, 2017 at 4:44 PM, Cory Johns wrote: > Alex beat me to it, but here's a marginally more complete example: > https://gist.github.com/johnsca/a91cb5897d92dfb6741ee1a09d82b39b > > The key points are: > > * The interface needs to be UNIT scoped (because you

Is base64 really the best way to use complex config values

2017-06-07 Thread Tilman Baumann
I see a lot of charms use base64 values in config parameters. Especially when the values are stuff like custom templates. Is this really the way to go? It may avoid shell quoting hell for parameters set via command line. (Usually trivial) But when set via --file option (which is clearly the

Re: How to count relations?

2017-06-07 Thread fengxia
Cory, Alex, good pointers! I had provider set to GLOBAL and require in UNIT. Maybe that's why. Let me take a look your example and follow your instructions here to give it another try. Thank you guys! On 06/07/2017 11:44 AM, Cory Johns wrote: Alex beat me to it, but here's a marginally

Re: How to count relations?

2017-06-07 Thread Cory Johns
Alex beat me to it, but here's a marginally more complete example: https://gist.github.com/johnsca/a91cb5897d92dfb6741ee1a09d82b39b The key points are: * The interface needs to be UNIT scoped (because you care about individual units) * The joined handler sets a state for each unit that joins *

How to count relations?

2017-06-07 Thread fengxia
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