Skip to content

Commit 5359579

Browse files
committed
Make jinja in oval.template more readable
1 parent d532cc4 commit 5359579

File tree

1 file changed

+60
-60
lines changed

1 file changed

+60
-60
lines changed

shared/templates/grub2_bootloader_argument/oval.template

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
<ind:state state_ref="state_grub2_{{{ SANITIZED_ARG_NAME }}}_argument_is_kernelopts" />
198198
</ind:textfilecontent54_test>
199199

200-
{{% if numeric_comparison %}}
200+
{{% if numeric_comparison %}}
201201
<ind:textfilecontent54_test id="test_grub2_{{{ SANITIZED_ARG_NAME }}}_entries_numeric"
202202
comment="check {{{ ARG_NAME }}} value meets {{{ OPERATION }}} in /boot/loader/entries"
203203
check="all" check_existence="any_exist" version="1">
@@ -213,7 +213,7 @@
213213
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
214214
<filter action="exclude">state_grub2_rescue_entry_for_{{{ _RULE_ID }}}</filter>
215215
</ind:textfilecontent54_object>
216-
{{% endif %}}
216+
{{%- endif %}}
217217
{{% endif %}}
218218

219219

@@ -227,11 +227,11 @@
227227

228228
<ind:textfilecontent54_object id="object_grub2_{{{ SANITIZED_ARG_NAME }}}_argument" version="1">
229229
<ind:filepath>/etc/default/grub</ind:filepath>
230-
{{% if numeric_comparison %}}
230+
{{% if numeric_comparison %}}
231231
<ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX=".*{{{ ESCAPED_ARG_NAME }}}=(\d+).*"$</ind:pattern>
232-
{{% else %}}
232+
{{% else %}}
233233
<ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX="(.*)"$</ind:pattern>
234-
{{% endif %}}
234+
{{% endif %}}
235235
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
236236
</ind:textfilecontent54_object>
237237

@@ -245,14 +245,14 @@
245245
<ind:textfilecontent54_object id="object_grub2_{{{ SANITIZED_ARG_NAME }}}_argument_default"
246246
version="1">
247247
<ind:filepath>/etc/default/grub</ind:filepath>
248-
{{% if numeric_comparison %}}
248+
{{% if numeric_comparison %}}
249249
<ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX_DEFAULT=".*{{{ ESCAPED_ARG_NAME }}}=(\d+).*"$</ind:pattern>
250-
{{% else %}}
250+
{{% else %}}
251251
<ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX_DEFAULT="(.*)"$</ind:pattern>
252-
{{% endif %}}
252+
{{% endif %}}
253253
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
254254
</ind:textfilecontent54_object>
255-
{{%- endif %}}
255+
{{% endif %}}
256256

257257
{{% if system_with_kernel_options_in_etc_default_grub_d -%}}
258258
<ind:textfilecontent54_test id="test_grub2_{{{ SANITIZED_ARG_NAME }}}_argument_configdir"
@@ -281,10 +281,10 @@
281281
<ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX_DEFAULT="(.*)"$</ind:pattern>
282282
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
283283
</ind:textfilecontent54_object>
284-
{{%- endif %}}
284+
{{% endif %}}
285285

286-
{{%- if system_with_kernel_options_in_grubenv or system_with_expanded_kernel_options_in_loader_entries_or_with_options_in_grubenv %}}
287-
{{%- macro test_and_object_for_kernel_options_grub_env(base_name, path) %}}
286+
{{% if system_with_kernel_options_in_grubenv or system_with_expanded_kernel_options_in_loader_entries_or_with_options_in_grubenv %}}
287+
{{%- macro test_and_object_for_kernel_options_grub_env(base_name, path) %}}
288288
<ind:textfilecontent54_test id="test_{{{ base_name }}}"
289289
comment="check for kernel command line parameters {{{ ARG_NAME_VALUE }}} in {{{ path }}} for all kernels"
290290
check="all" check_existence="all_exist" version="1">
@@ -295,22 +295,22 @@
295295
<ind:textfilecontent54_object id="object_{{{ base_name }}}"
296296
version="1">
297297
<ind:filepath>{{{ path }}}</ind:filepath>
298-
{{% if numeric_comparison %}}
298+
{{% if numeric_comparison %}}
299299
<ind:pattern operation="pattern match">^kernelopts=.*{{{ ESCAPED_ARG_NAME }}}=(\d+)</ind:pattern>
300-
{{% else %}}
300+
{{% else %}}
301301
<ind:pattern operation="pattern match">^kernelopts=(.*)$</ind:pattern>
302-
{{% endif %}}
302+
{{% endif %}}
303303
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
304304
</ind:textfilecontent54_object>
305-
{{%- endmacro %}}
305+
{{%- endmacro %}}
306306

307-
{{{ test_and_object_for_kernel_options_grub_env("grub2_" ~ SANITIZED_ARG_NAME ~ "_argument_grub_env", grub2_boot_path ~ "/grubenv") }}}
308-
{{% if system_with_bios_and_uefi_support -%}}
309-
{{{ test_and_object_for_kernel_options_grub_env("grub2_" ~ SANITIZED_ARG_NAME ~ "_argument_grub_env_uefi", grub2_uefi_boot_path ~ "/grubenv") }}}
310-
{{%- endif %}}
311-
{{%- endif %}}
307+
{{{- test_and_object_for_kernel_options_grub_env("grub2_" ~ SANITIZED_ARG_NAME ~ "_argument_grub_env", grub2_boot_path ~ "/grubenv") }}}
308+
{{%- if system_with_bios_and_uefi_support -%}}
309+
{{{- test_and_object_for_kernel_options_grub_env("grub2_" ~ SANITIZED_ARG_NAME ~ "_argument_grub_env_uefi", grub2_uefi_boot_path ~ "/grubenv") }}}
310+
{{%- endif %}}
311+
{{% endif %}}
312312

313-
{{%- if system_with_expanded_kernel_options_in_loader_entries %}}
313+
{{% if system_with_expanded_kernel_options_in_loader_entries %}}
314314
<ind:textfilecontent54_test id="test_grub2_{{{ SANITIZED_ARG_NAME }}}_entries"
315315
comment="check kernel command line parameters for {{{ ARG_NAME_VALUE }}} for all boot entries."
316316
check="all" check_existence="all_exist" version="1">
@@ -321,22 +321,22 @@
321321
<ind:textfilecontent54_object id="obj_grub2_{{{ SANITIZED_ARG_NAME }}}_entries" version="1">
322322
<ind:path>/boot/loader/entries/</ind:path>
323323
<ind:filename operation="pattern match">^.*\.conf$</ind:filename>
324-
{{% if numeric_comparison %}}
324+
{{% if numeric_comparison %}}
325325
<ind:pattern operation="pattern match">^options .*{{{ ESCAPED_ARG_NAME }}}=(\d+)</ind:pattern>
326-
{{% else %}}
326+
{{% else %}}
327327
<ind:pattern operation="pattern match">^options (.*)$</ind:pattern>
328-
{{% endif %}}
328+
{{% endif %}}
329329
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
330330
<filter action="exclude">state_grub2_rescue_entry_for_{{{ _RULE_ID }}}</filter>
331331
</ind:textfilecontent54_object>
332332

333333
<ind:textfilecontent54_state id="state_grub2_rescue_entry_for_{{{ _RULE_ID }}}" version="1">
334334
<ind:filename operation="pattern match">.*rescue\.conf$</ind:filename>
335335
</ind:textfilecontent54_state>
336-
{{%- endif %}}
336+
{{% endif %}}
337337

338-
{{%- if system_with_expanded_kernel_options_in_grub_cfg %}}
339-
{{%- macro test_and_object_for_kernel_options_grub_cfg(base_name, path) %}}
338+
{{% if system_with_expanded_kernel_options_in_grub_cfg %}}
339+
{{%- macro test_and_object_for_kernel_options_grub_cfg(base_name, path) %}}
340340
<ind:textfilecontent54_test id="test_{{{ base_name }}}"
341341
comment="check kernel command line parameters for {{{ ARG_NAME_VALUE }}} in {{{ path }}} for all kernels"
342342
check="all" check_existence="all_exist" version="1">
@@ -347,28 +347,28 @@
347347
<ind:textfilecontent54_object id="object_{{{ base_name }}}"
348348
version="1">
349349
<ind:filepath>{{{ path }}}</ind:filepath>
350-
{{% if product in ["ol7"] or 'ubuntu' in product %}}
351-
{{% if numeric_comparison %}}
350+
{{% if product in ["ol7"] or 'ubuntu' in product %}}
351+
{{% if numeric_comparison %}}
352352
<ind:pattern operation="pattern match">^.*/vmlinuz.*{{{ ESCAPED_ARG_NAME }}}=(\d+)</ind:pattern>
353-
{{% else %}}
354-
<ind:pattern operation="pattern match">^.*/vmlinuz.*(root=.*)$</ind:pattern>
355-
{{% endif %}}
356353
{{% else %}}
357-
{{% if numeric_comparison %}}
354+
<ind:pattern operation="pattern match">^.*/vmlinuz.*(root=.*)$</ind:pattern>
355+
{{% endif %}}
356+
{{% else %}}
357+
{{% if numeric_comparison %}}
358358
<ind:pattern operation="pattern match">^set default_kernelopts=.*{{{ ESCAPED_ARG_NAME }}}=(\d+)</ind:pattern>
359-
{{% else %}}
359+
{{% else %}}
360360
<ind:pattern operation="pattern match">^set default_kernelopts=(.*)$</ind:pattern>
361-
{{% endif %}}
362361
{{% endif %}}
362+
{{% endif %}}
363363
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
364364
</ind:textfilecontent54_object>
365-
{{%- endmacro %}}
365+
{{%- endmacro %}}
366366

367-
{{{ test_and_object_for_kernel_options_grub_cfg("grub2_" + SANITIZED_ARG_NAME + "_argument_grub_cfg", grub2_boot_path ~ "/grub.cfg") }}}
368-
{{% if system_with_bios_and_uefi_support -%}}
369-
{{{ test_and_object_for_kernel_options_grub_cfg("grub2_" + SANITIZED_ARG_NAME + "_argument_grub_cfg_uefi", grub2_uefi_boot_path ~ "/grub.cfg") }}}
370-
{{%- endif %}}
371-
{{%- endif %}}
367+
{{{- test_and_object_for_kernel_options_grub_cfg("grub2_" + SANITIZED_ARG_NAME + "_argument_grub_cfg", grub2_boot_path ~ "/grub.cfg") }}}
368+
{{%- if system_with_bios_and_uefi_support -%}}
369+
{{{- test_and_object_for_kernel_options_grub_cfg("grub2_" + SANITIZED_ARG_NAME + "_argument_grub_cfg_uefi", grub2_uefi_boot_path ~ "/grub.cfg") }}}
370+
{{%- endif %}}
371+
{{% endif %}}
372372

373373
{{% if system_with_expanded_kernel_options_in_loader_entries_or_with_options_in_grubenv %}}
374374
<ind:textfilecontent54_state id="state_grub2_{{{ SANITIZED_ARG_NAME }}}_argument_is_kernelopts"
@@ -382,12 +382,12 @@
382382
{{% if numeric_comparison %}}
383383
<ind:textfilecontent54_state id="state_grub2_{{{ SANITIZED_ARG_NAME }}}_argument"
384384
version="1">
385-
{{% if ARG_VARIABLE %}}
385+
{{% if ARG_VARIABLE %}}
386386
<ind:subexpression datatype="int" operation="{{{ OPERATION }}}"
387387
var_ref="{{{ ARG_VARIABLE }}}" />
388-
{{% else %}}
388+
{{% else %}}
389389
<ind:subexpression datatype="int" operation="{{{ OPERATION }}}">{{{ ARG_VALUE }}}</ind:subexpression>
390-
{{% endif %}}
390+
{{% endif %}}
391391
</ind:textfilecontent54_state>
392392
{{% if ARG_VARIABLE %}}
393393
<external_variable comment="Variable for {{{ ARG_NAME }}}"
@@ -409,13 +409,13 @@
409409
datatype="string" version="1">
410410
<concat>
411411
<literal_component>^(?:.*\s)?{{{ ARG_NAME }}}=</literal_component>
412-
{{% if IS_SUBSTRING == "true" %}}
412+
{{% if IS_SUBSTRING == "true" %}}
413413
<literal_component>\S*</literal_component>
414-
{{% endif %}}
414+
{{% endif %}}
415415
<variable_component var_ref="{{{ ARG_VARIABLE }}}" />
416-
{{% if IS_SUBSTRING == "true" %}}
416+
{{% if IS_SUBSTRING == "true" %}}
417417
<literal_component>\S*</literal_component>
418-
{{% endif %}}
418+
{{% endif %}}
419419
<literal_component>(?:\s.*)?$</literal_component>
420420
</concat>
421421
</local_variable>
@@ -434,14 +434,14 @@
434434
<ind:textfilecontent54_object id="object_grub2_{{{ SANITIZED_ARG_NAME }}}_usr_lib_bootc_kargs_d" version="1">
435435
<ind:path>/usr/lib/bootc/kargs.d/</ind:path>
436436
<ind:filename operation="pattern match">^.*\.toml$</ind:filename>
437-
{{% if numeric_comparison %}}
437+
{{% if numeric_comparison %}}
438438
<ind:pattern operation="pattern match">^kargs = \[.*"{{{ ESCAPED_ARG_NAME }}}=(\d+)".*\]$</ind:pattern>
439-
{{% else %}}
439+
{{% else %}}
440440
<ind:pattern operation="pattern match">^kargs = \[([^\]]+)\]$</ind:pattern>
441-
{{% endif %}}
441+
{{% endif %}}
442442
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
443443
</ind:textfilecontent54_object>
444-
{{% if numeric_comparison %}}
444+
{{%- if numeric_comparison %}}
445445
<ind:textfilecontent54_state id="state_grub2_{{{ SANITIZED_ARG_NAME }}}_usr_lib_bootc_kargs_d" version="1">
446446
{{% if ARG_VARIABLE %}}
447447
<ind:subexpression datatype="int" operation="{{{ OPERATION }}}"
@@ -450,11 +450,11 @@
450450
<ind:subexpression datatype="int" operation="{{{ OPERATION }}}">{{{ ARG_VALUE }}}</ind:subexpression>
451451
{{% endif %}}
452452
</ind:textfilecontent54_state>
453-
{{% elif not ARG_VARIABLE %}}
453+
{{%- elif not ARG_VARIABLE %}}
454454
<ind:textfilecontent54_state id="state_grub2_{{{ SANITIZED_ARG_NAME }}}_usr_lib_bootc_kargs_d" version="1">
455455
<ind:subexpression operation="pattern match">^.*"{{{ ESCAPED_ARG_NAME_VALUE }}}".*$</ind:subexpression>
456456
</ind:textfilecontent54_state>
457-
{{% else %}}
457+
{{%- else %}}
458458
<ind:textfilecontent54_state id="state_grub2_{{{ SANITIZED_ARG_NAME }}}_usr_lib_bootc_kargs_d" version="1">
459459
<ind:subexpression operation="pattern match" var_ref="local_var_regex_{{{ SANITIZED_ARG_NAME }}}_{{{ ARG_VARIABLE }}}_bootc_kargs" />
460460
</ind:textfilecontent54_state>
@@ -464,19 +464,19 @@
464464
datatype="string" version="1">
465465
<concat>
466466
<literal_component>^.*"{{{ ARG_NAME }}}=</literal_component>
467-
{{% if IS_SUBSTRING == "true" %}}
467+
{{% if IS_SUBSTRING == "true" %}}
468468
<literal_component>\S*</literal_component>
469-
{{% endif %}}
469+
{{% endif %}}
470470
<variable_component var_ref="{{{ ARG_VARIABLE }}}" />
471-
{{% if IS_SUBSTRING == "true" %}}
471+
{{% if IS_SUBSTRING == "true" %}}
472472
<literal_component>\S*</literal_component>
473-
{{% endif %}}
473+
{{% endif %}}
474474
<literal_component>".*$</literal_component>
475475
</concat>
476476
</local_variable>
477477

478478
<external_variable comment="Variable defining the value the argument should have" datatype="string" id="{{{ ARG_VARIABLE }}}" version="1" />
479-
{{% endif %}}
479+
{{%- endif %}}
480480
{{% endif %}}
481481

482482
</def-group>

0 commit comments

Comments
 (0)