Fix Jinja2 escaping of zsh PROMPT in cloud-init template (#41)

* Fix Jinja2 escaping of zsh PROMPT in cloud-init template

The zsh PROMPT string contains `%` sequences that Jinja2 interprets
as template syntax. Wrap in {% raw %}...{% endraw %} to preserve
the literal prompt definition.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add a warning to the cloud-init jinja template

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Riccardo Schirone
2026-02-23 14:58:28 +01:00
committed by GitHub
parent 5982a3b55e
commit fde89df590
+2 -1
View File
@@ -1,4 +1,5 @@
#cloud-config
# Warning: This whole file will be evaluated by Jinja. Escape any special literals (`{{`, `{%`, `{#`).
# Update and upgrade system packages
package_update: true
@@ -47,7 +48,7 @@ write_files:
defer: true
content: |
# Prompt: user@host:dir (green for normal, red after failed command)
PROMPT='%F{%(?.green.red)}%n@%m%f:%F{blue}%~%f$ '
{% raw %}PROMPT='%F{%(?.green.red)}%n@%m%f:%F{blue}%~%f$ '{% endraw %}
# History
HISTFILE=~/.zsh_history