From: Dimitri Savineau Date: Wed, 14 Jul 2021 18:57:51 +0000 (-0400) Subject: mgr/cephadm/templates: add jinja2 lint X-Git-Tag: v16.2.6~54^2~37 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a1fcefa17d2a7dca5e50080416f9e58984d65efc;p=ceph.git mgr/cephadm/templates: add jinja2 lint This adds a jinja2 lint environment in tox for testing the cephadm jinja2 templates. This patch fixes some minor jinja2 syntax for ganesha and keepalived even if the current templates work perfectly. Tags should have one (and only one) space Signed-off-by: Dimitri Savineau (cherry picked from commit 9eac2fba90a3b179087455100e494d7da6b0910e) --- diff --git a/src/pybind/mgr/CMakeLists.txt b/src/pybind/mgr/CMakeLists.txt index 679d0d9ae58b..833faf1aa084 100644 --- a/src/pybind/mgr/CMakeLists.txt +++ b/src/pybind/mgr/CMakeLists.txt @@ -6,7 +6,7 @@ if(WITH_MGR_ROOK_CLIENT) endif() if(WITH_TESTS) include(AddCephTest) - add_tox_test(mgr ${CMAKE_CURRENT_SOURCE_DIR} TOX_ENVS py3 mypy flake8) + add_tox_test(mgr ${CMAKE_CURRENT_SOURCE_DIR} TOX_ENVS py3 mypy flake8 jinjalint) endif() # Location needs to match default setting for mgr_module_path, currently: diff --git a/src/pybind/mgr/cephadm/templates/services/ingress/keepalived.conf.j2 b/src/pybind/mgr/cephadm/templates/services/ingress/keepalived.conf.j2 index 2c4e326f6db1..4caeebf51f9e 100644 --- a/src/pybind/mgr/cephadm/templates/services/ingress/keepalived.conf.j2 +++ b/src/pybind/mgr/cephadm/templates/services/ingress/keepalived.conf.j2 @@ -19,7 +19,7 @@ vrrp_instance VI_0 { } unicast_src_ip {{ host_ip }} unicast_peer { - {% for ip in other_ips %} + {% for ip in other_ips %} {{ ip }} {% endfor %} } diff --git a/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2 b/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2 index aae3b671eaf7..6fb47945427f 100644 --- a/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2 +++ b/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2 @@ -25,7 +25,7 @@ NFSv4 { RADOS_KV { UserId = "{{ user }}"; - nodeid = "{{ nodeid}}"; + nodeid = "{{ nodeid }}"; pool = "{{ pool }}"; namespace = "{{ namespace }}"; } diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini index 4835fa1157a9..9a2cc0fc8c34 100644 --- a/src/pybind/mgr/tox.ini +++ b/src/pybind/mgr/tox.ini @@ -5,6 +5,7 @@ envlist = test, fix flake8 + jinjalint skipsdist = true requires = cython @@ -102,3 +103,10 @@ modules = commands = flake8 --config=tox.ini {posargs} \ {posargs:{[testenv:flake8]modules}} + +[testenv:jinjalint] +basepython = python3 +deps = + jinjaninja +commands = + jinja-ninja cephadm/templates