From d3ec39c8f110aa13c0980cf0244a474e1ec18484 Mon Sep 17 00:00:00 2001 From: geoffrey Date: Mon, 26 Jun 2023 21:05:54 +0200 Subject: [PATCH] Add accordion-id for sysctl report --- core/report.py | 9 ++++++--- reports/templates/sysctl.html.j2 | 10 +++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/report.py b/core/report.py index 73ffb44..b5524e6 100644 --- a/core/report.py +++ b/core/report.py @@ -35,14 +35,17 @@ def generateHtmlReport(data): dataJinja2['sysctl']['file']['filename'] = data['system']['sysctl']['file']['filename'] dataJinja2['sysctl']['file']['sysctl'] = data['system']['sysctl']['file']['sysctl'] - for sysctl in data['system']['sysctl']['file']: - pass + index = 1 + + for sysctl in dataJinja2['sysctl']['file']['sysctl']: + dataJinja2['sysctl']['file']['sysctl'][sysctl]['accordion-id'] = f"accordion-{index}" + index += 1 #print(data['system']['sysctl']['file'][sysctl]) #for entry in data['system']['sysctl']['file']['sysctl']: # print(entry) # print(data['system']['sysctl']['file']['sysctl'][entry]) - print(dataJinja2) + #print(dataJinja2) dataJinja2['year'] = '2023' rdr = tmplIndex.render(data=dataJinja2) diff --git a/reports/templates/sysctl.html.j2 b/reports/templates/sysctl.html.j2 index d9b524a..2fd7fd5 100644 --- a/reports/templates/sysctl.html.j2 +++ b/reports/templates/sysctl.html.j2 @@ -1,16 +1,16 @@

Sysctl

{% for item in data['sysctl']['file']['sysctl'] %} -
+

-

-
+
- {{ data['sysctl']['file']['sysctl'][item]['description'] }} + {{ data['sysctl']['file']['sysctl'][item]['description'] }}