From 9eac2fba90a3b179087455100e494d7da6b0910e Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Wed, 14 Jul 2021 14:57:51 -0400 Subject: [PATCH] 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 --- src/pybind/mgr/CMakeLists.txt | 2 +- .../cephadm/templates/services/ingress/keepalived.conf.j2 | 2 +- .../mgr/cephadm/templates/services/nfs/ganesha.conf.j2 | 2 +- src/pybind/mgr/tox.ini | 8 ++++++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/CMakeLists.txt b/src/pybind/mgr/CMakeLists.txt index b68daf925892..0f5cad52779c 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 ec000c07ade9..9d6e15f1c4f7 100644 --- a/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2 +++ b/src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2 @@ -17,7 +17,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 b47dec315581..8664e1ca9db7 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 @@ -152,3 +153,10 @@ modules = commands = flake8 --config=tox.ini {posargs} \ {posargs:{[testenv:flake8]modules}} + +[testenv:jinjalint] +basepython = python3 +deps = + jinjaninja +commands = + jinja-ninja cephadm/templates -- 2.47.3