Skip to content

[mirrorllist] template error when mirrorlist.country is absent #127

@petRUShka

Description

@petRUShka

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 %} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions