relation-get output is problematic

Gustavo Niemeyer gustavo at niemeyer.net
Wed May 9 20:21:29 UTC 2012


On Wed, May 9, 2012 at 1:19 PM, William Reade
<william.reade at canonical.com> wrote:
> On Wed, 2012-05-09 at 13:09 -0700, Gustavo Niemeyer wrote:
>> My proposal is this:
>>
>> - Let's make the default output for everything structured be YAML
>> (e.g. relation-get -)
>> - Things like juju-log must not output *anything* (it is/was outputting {})
>
> +1
>
>> Then, I'd also like to take the chance to propose an extension to
>> relation-get to help people that are getting out of the
>>
>>     if [ `relation-get some-bool` = True ]; then ...; fi
>>
>> situation, that actually makes the charm interface depend on
>> Python-specific value names, onto a much better version:
>>
>>     if relation-get --test some-bool; then ...; fi
>
> +1 in principle; but I'd like to be sure what counts as true or false.
> Boolean false should clearly be false; values that are entirely missing
> should also be false; and almost everything else should certainly be
> true; but what about zero numbers and empty strings? I'm personally
> comfortable with treating those as true, but there's a case to be made
> either way...

I think the behavior that would most benefit shell users is:

Everything is true, but:

- boolean false
- numeric zero
- empty string

-- 
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/plus
http://niemeyer.net/twitter
http://niemeyer.net/blog

-- I'm not absolutely sure of anything.



More information about the Juju mailing list