]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm/templates: add jinja2 lint 42342/head
authorDimitri Savineau <dsavinea@redhat.com>
Wed, 14 Jul 2021 18:57:51 +0000 (14:57 -0400)
committerDimitri Savineau <dsavinea@redhat.com>
Tue, 20 Jul 2021 13:58:15 +0000 (09:58 -0400)
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>
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 b68daf925892ae09d5c250c86c3d88108f74c85d..0f5cad52779c41c63af2dfe2e6e8a07e9903b5e1 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 ec000c07ade9126f295c219c13e40e53caf8d8c5..9d6e15f1c4f7111036384e269898f16501069732 100644 (file)
@@ -17,7 +17,7 @@ NFSv4 {
 
 RADOS_KV {
         UserId = "{{ user }}";
-        nodeid = "{{ nodeid}}";
+        nodeid = "{{ nodeid }}";
         pool = "{{ pool }}";
         namespace = "{{ namespace }}";
 }
index b47dec315581ce66b323549e6bfc11c90398ebfe..8664e1ca9db76b9e17f0a867ebf65da63da599ba 100644 (file)
@@ -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