relation-get output is problematic

Mark Mims mark.mims at canonical.com
Tue May 15 00:05:17 UTC 2012


numeric zero as "false" is non-idiomatic and unexpected in shell.
0 is the _opposite_ of being empty:

$ [ 0 ] && echo "yes" || echo "no"
yes
$ [ "$HOME" ] && echo "yes" || echo "no"
yes

$ [ ] && echo "yes" || echo "no"
no
$ [ "" ] && echo "yes" || echo "no"
no
$ [ "$HOMER" ] && echo "yes" || echo "no"
no

not sure what to recommend...

on one hand, we can make this work... to support multiple langs, we've 
probably just got to be opinionated here

on the other hand, it's quite reasonable to expect `config-get 
bool_parameter` to return shell values consistent with the intention of 
the boolean parameter

?


On 05/09/2012 03:58 PM, Gustavo Niemeyer wrote:
> On Wed, May 9, 2012 at 2:53 PM, William Reade
> <william.reade at canonical.com>  wrote:
>> On Wed, 2012-05-09 at 14:47 -0700, Gustavo Niemeyer wrote:
>>> Amending it, everything is true but:
>>>
>>> - boolean false
>>> - numeric zero
>>> - empty string
>>> - empty dict
>>> - empty list
>>>
>> ...and missing-key, right?
> +1
>


-- 
Mark Mims, Ph.D.
Canonical Ltd.
mark.mims at canonical.com
+1(512)981-6467




More information about the Juju mailing list