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

Deploy failure: template error while templating string #112

Closed
copelco opened this issue Jun 24, 2022 · 1 comment · Fixed by #113
Closed

Deploy failure: template error while templating string #112

copelco opened this issue Jun 24, 2022 · 1 comment · Fixed by #113
Labels
bug Something isn't working

Comments

@copelco
Copy link
Member

copelco commented Jun 24, 2022

TASK [caktus.django-k8s : Create/update templates in Kubernetes] ***************
ok: [staging] => (item={'name': 'registry_secret.yaml.j2', 'state': 'absent'})
ok: [staging] => (item={'name': 'redis.yaml.j2', 'state': 'present'})
ok: [staging] => (item={'name': 'elasticsearch.yaml.j2', 'state': 'absent'})
ok: [staging] => (item={'name': 'memcached.yaml.j2', 'state': 'absent'})
fatal: [staging]: FAILED! => 
  msg: |-
    An unhandled exception occurred while running the lookup plugin 'template'. Error was a <class 'ansible.errors.AnsibleError'>, original message: template error while templating string: expected token 'end of statement block', got '+'. String: {#
    Anywhere we need to inject a non-scalar value, we use to_json instead of to_yaml because it:
    1) more reliably includes wrapping {}
    2) behaves identically on Python 2 and Python 3
    (and all JSON is valid YAML).
    #}
@copelco copelco added the bug Something isn't working label Jun 24, 2022
@copelco copelco linked a pull request Jun 24, 2022 that will close this issue
@copelco
Copy link
Member Author

copelco commented Jun 27, 2022

Upgrading Jinja seems to fix this:

-jinja2==2.11.2
+jinja2==3.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant