]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm/templates: add jinja2 lint
authorDimitri Savineau <dsavinea@redhat.com>
Wed, 14 Jul 2021 18:57:51 +0000 (14:57 -0400)
committerSebastian Wagner <sewagner@redhat.com>
Tue, 10 Aug 2021 14:32:13 +0000 (16:32 +0200)
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 <dsavinea@redhat.com>
(cherry picked from commit 9eac2fba90a3b179087455100e494d7da6b0910e)

src/pybind/mgr/CMakeLists.txt
src/pybind/mgr/cephadm/templates/services/ingress/keepalived.conf.j2
src/pybind/mgr/cephadm/templates/services/nfs/ganesha.conf.j2
src/pybind/mgr/tox.ini

index 679d0d9ae58ba3cf9f739cb344f89517f2706fa3..833faf1aa0846982f6ce92b068b5759b1d1ca6e7 100644 (file)
@@ -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:
index 2c4e326f6db1fd5adee72fe227fc6170aafaafc6..4caeebf51f9e0cc2727d30232cefc90fc0733e49 100644 (file)
@@ -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 %}
   }
index aae3b671eaf7c0e52735666ef03eb9910597b45e..6fb47945427f7b07144a7a7e285287c06d22c41c 100644 (file)
@@ -25,7 +25,7 @@ NFSv4 {
 
 RADOS_KV {
         UserId = "{{ user }}";
-        nodeid = "{{ nodeid}}";
+        nodeid = "{{ nodeid }}";
         pool = "{{ pool }}";
         namespace = "{{ namespace }}";
 }
index 4835fa1157a99a75a6a6b787ed8e0b226104ef89..9a2cc0fc8c34b1c370bfb86ab37a71047395e3b7 100644 (file)
@@ -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