pigmonkey/spark

[mirrorllist] template error when mirrorlist.country is absent

petRUShka opened this issue · 2 comments

There is a template error if mirrorlist.country is absent:

AnsibleError: template error while templating string: unexpected '}'. 

String: #!/bin/bash\n# {{ ansible_managed}\n#\n/usr/bin/reflector --latest 20 \\\n                   {% if mirrorlist.country %}--country {{ mirrorlist.country }} \\\n                   {% endif %}\n                   --sort rate \\\n                   --protocol https \\\n                   --save /etc/pacman.d/mirrorlist\n                   \nif [[ -f /etc/pacman.d/mirrorlist.pacnew ]]; then\n    rm /etc/pacman.d/mirrorlist.pacnew\nfi\n. unexpected '}'"

I believe that the solution is something like this:

{% if mirrorlist.country is defined and mirrorlist.country %}--country {{ mirrorlist.country }} \
{% endif %} 

It seems that actual problem is missed closed } in # {{ ansible_managed}

@petRUShka : that was my mistake, thanks for catching it. Pull request sent.