From: John Mulligan Date: Thu, 28 Sep 2023 20:44:14 +0000 (-0400) Subject: cephadm: add shellquote filter to template X-Git-Tag: v19.1.0~658^2~6 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=66b7f3245c3fb56a5500ac009ce2ac70aa6a1fc8;p=ceph.git cephadm: add shellquote filter to template This is to support generating command lines or shell scripts using Jinja2 templates in the future. Signed-off-by: John Mulligan --- diff --git a/src/cephadm/cephadmlib/templating.py b/src/cephadm/cephadmlib/templating.py index a431ba669999d..5f4dda0560864 100644 --- a/src/cephadm/cephadmlib/templating.py +++ b/src/cephadm/cephadmlib/templating.py @@ -3,6 +3,7 @@ import enum import os import posixpath +import shlex import zipimport from typing import Any, Optional, IO, Tuple, Callable, cast @@ -113,6 +114,7 @@ class Templater: def _env(self) -> jinja2.Environment: if self._jinja2_env is None: self._jinja2_env = jinja2.Environment(loader=self._loader) + self._jinja2_env.filters['shellquote'] = shlex.quote return self._jinja2_env @property