From fde89df590b68cd38ef60466d2ffe7378cb871c7 Mon Sep 17 00:00:00 2001 From: Riccardo Schirone <562321+ret2libc@users.noreply.github.com> Date: Mon, 23 Feb 2026 14:58:28 +0100 Subject: [PATCH] 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 * Add a warning to the cloud-init jinja template --------- Co-authored-by: Claude Opus 4.6 --- dropkit/templates/default-cloud-init.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dropkit/templates/default-cloud-init.yaml b/dropkit/templates/default-cloud-init.yaml index 828e1c4..07a7e23 100644 --- a/dropkit/templates/default-cloud-init.yaml +++ b/dropkit/templates/default-cloud-init.yaml @@ -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