would this not work?
foo|length == 0

On Thu, Nov 20, 2014 at 2:21 PM, Dmitry Makovey <[email protected]> wrote:
> Hi,
>
> several times now I came across situation where one of the modules returns
> 'empty list' in variable and it would be handy to have a simple test like:
>
> {% if foo is empty %}
>
> which is not the same as
>
> {% if foo is defined %}
>
> because former case covers also "", [], {} and None as well as "undefined".
> Sort of like "empty()" call in PHP.
>
> Right now I've been managing situation with crutches like:
>
> when: foo_list|join('') != ''
>
> but that is non-descriptive and hackish IMO. Is there an interest of adding
> this feature? Shall I post into Github issue tracker?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/9d9f8ef2-87df-4a50-80c9-eec1cb1e84e1%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Brian Coca

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJ5XC8m4tQfP1qNxp-zSB-Q8qQS2khPGwvs30WNDqiegSE72tQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to