From: Dimitri Savineau Date: Wed, 14 Jul 2021 18:57:51 +0000 (-0400) Subject: mgr/cephadm/templates: add jinja2 lint X-Git-Tag: v17.1.0~1326^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F42342%2Fhead;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 --- diff --git a/src/pybind/mgr/CMakeLists.txt b/src/pybind/mgr/CMakeLists.txt index b68daf92589..0f5cad52779 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 2c4e326f6db..4caeebf51f9 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 ec000c07ade..9d6e15f1c4f 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 b47dec31558..8664e1ca9db 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