Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
petRUShka opened this issue Oct 19, 2024 · 2 comments
Open

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

petRUShka opened this issue Oct 19, 2024 · 2 comments

Comments

@petRUShka
Copy link
Contributor

petRUShka commented Oct 19, 2024

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 %} 
@petRUShka
Copy link
Contributor Author

petRUShka commented Oct 19, 2024

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

@brett
Copy link
Contributor

brett commented Oct 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants