kostiantyn-nemchenko / ansible-role-patroni

:elephant: Ansible Role for Patroni

Home Page:https://galaxy.ansible.com/kostiantyn-nemchenko/patroni

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check that variable is defined and is not empty

kostiantyn-nemchenko opened this issue · comments

An ugly condition (e.g. if not( (patroni_etcd_url is none) or (patroni_etcd_url | trim == '') )) for checking that variable is defined and is not empty should be improved somehow.
Perhaps, a custom Jinja filter will do the trick

TODO: Take a look at the second parameter of the default filter default(value, default_value=u’’, boolean=False)

If the value isn’t defined, default will display what’s in the default_value field. Passing in a true as the second parameter will return the default value if the value is defined but blank.