|
197 | 197 | <ind:state state_ref="state_grub2_{{{ SANITIZED_ARG_NAME }}}_argument_is_kernelopts" /> |
198 | 198 | </ind:textfilecontent54_test> |
199 | 199 |
|
200 | | -{{% if numeric_comparison %}} |
| 200 | + {{% if numeric_comparison %}} |
201 | 201 | <ind:textfilecontent54_test id="test_grub2_{{{ SANITIZED_ARG_NAME }}}_entries_numeric" |
202 | 202 | comment="check {{{ ARG_NAME }}} value meets {{{ OPERATION }}} in /boot/loader/entries" |
203 | 203 | check="all" check_existence="any_exist" version="1"> |
|
213 | 213 | <ind:instance datatype="int" operation="greater than or equal">1</ind:instance> |
214 | 214 | <filter action="exclude">state_grub2_rescue_entry_for_{{{ _RULE_ID }}}</filter> |
215 | 215 | </ind:textfilecontent54_object> |
216 | | -{{% endif %}} |
| 216 | + {{%- endif %}} |
217 | 217 | {{% endif %}} |
218 | 218 |
|
219 | 219 |
|
|
227 | 227 |
|
228 | 228 | <ind:textfilecontent54_object id="object_grub2_{{{ SANITIZED_ARG_NAME }}}_argument" version="1"> |
229 | 229 | <ind:filepath>/etc/default/grub</ind:filepath> |
230 | | - {{% if numeric_comparison %}} |
| 230 | + {{% if numeric_comparison %}} |
231 | 231 | <ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX=".*{{{ ESCAPED_ARG_NAME }}}=(\d+).*"$</ind:pattern> |
232 | | - {{% else %}} |
| 232 | + {{% else %}} |
233 | 233 | <ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX="(.*)"$</ind:pattern> |
234 | | - {{% endif %}} |
| 234 | + {{% endif %}} |
235 | 235 | <ind:instance datatype="int" operation="greater than or equal">1</ind:instance> |
236 | 236 | </ind:textfilecontent54_object> |
237 | 237 |
|
|
245 | 245 | <ind:textfilecontent54_object id="object_grub2_{{{ SANITIZED_ARG_NAME }}}_argument_default" |
246 | 246 | version="1"> |
247 | 247 | <ind:filepath>/etc/default/grub</ind:filepath> |
248 | | - {{% if numeric_comparison %}} |
| 248 | + {{% if numeric_comparison %}} |
249 | 249 | <ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX_DEFAULT=".*{{{ ESCAPED_ARG_NAME }}}=(\d+).*"$</ind:pattern> |
250 | | - {{% else %}} |
| 250 | + {{% else %}} |
251 | 251 | <ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX_DEFAULT="(.*)"$</ind:pattern> |
252 | | - {{% endif %}} |
| 252 | + {{% endif %}} |
253 | 253 | <ind:instance datatype="int" operation="greater than or equal">1</ind:instance> |
254 | 254 | </ind:textfilecontent54_object> |
255 | | -{{%- endif %}} |
| 255 | +{{% endif %}} |
256 | 256 |
|
257 | 257 | {{% if system_with_kernel_options_in_etc_default_grub_d -%}} |
258 | 258 | <ind:textfilecontent54_test id="test_grub2_{{{ SANITIZED_ARG_NAME }}}_argument_configdir" |
|
281 | 281 | <ind:pattern operation="pattern match">^\s*GRUB_CMDLINE_LINUX_DEFAULT="(.*)"$</ind:pattern> |
282 | 282 | <ind:instance datatype="int" operation="greater than or equal">1</ind:instance> |
283 | 283 | </ind:textfilecontent54_object> |
284 | | -{{%- endif %}} |
| 284 | +{{% endif %}} |
285 | 285 |
|
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) %}} |
288 | 288 | <ind:textfilecontent54_test id="test_{{{ base_name }}}" |
289 | 289 | comment="check for kernel command line parameters {{{ ARG_NAME_VALUE }}} in {{{ path }}} for all kernels" |
290 | 290 | check="all" check_existence="all_exist" version="1"> |
|
295 | 295 | <ind:textfilecontent54_object id="object_{{{ base_name }}}" |
296 | 296 | version="1"> |
297 | 297 | <ind:filepath>{{{ path }}}</ind:filepath> |
298 | | - {{% if numeric_comparison %}} |
| 298 | + {{% if numeric_comparison %}} |
299 | 299 | <ind:pattern operation="pattern match">^kernelopts=.*{{{ ESCAPED_ARG_NAME }}}=(\d+)</ind:pattern> |
300 | | - {{% else %}} |
| 300 | + {{% else %}} |
301 | 301 | <ind:pattern operation="pattern match">^kernelopts=(.*)$</ind:pattern> |
302 | | - {{% endif %}} |
| 302 | + {{% endif %}} |
303 | 303 | <ind:instance datatype="int" operation="greater than or equal">1</ind:instance> |
304 | 304 | </ind:textfilecontent54_object> |
305 | | -{{%- endmacro %}} |
| 305 | + {{%- endmacro %}} |
306 | 306 |
|
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 %}} |
312 | 312 |
|
313 | | -{{%- if system_with_expanded_kernel_options_in_loader_entries %}} |
| 313 | +{{% if system_with_expanded_kernel_options_in_loader_entries %}} |
314 | 314 | <ind:textfilecontent54_test id="test_grub2_{{{ SANITIZED_ARG_NAME }}}_entries" |
315 | 315 | comment="check kernel command line parameters for {{{ ARG_NAME_VALUE }}} for all boot entries." |
316 | 316 | check="all" check_existence="all_exist" version="1"> |
|
321 | 321 | <ind:textfilecontent54_object id="obj_grub2_{{{ SANITIZED_ARG_NAME }}}_entries" version="1"> |
322 | 322 | <ind:path>/boot/loader/entries/</ind:path> |
323 | 323 | <ind:filename operation="pattern match">^.*\.conf$</ind:filename> |
324 | | - {{% if numeric_comparison %}} |
| 324 | + {{% if numeric_comparison %}} |
325 | 325 | <ind:pattern operation="pattern match">^options .*{{{ ESCAPED_ARG_NAME }}}=(\d+)</ind:pattern> |
326 | | - {{% else %}} |
| 326 | + {{% else %}} |
327 | 327 | <ind:pattern operation="pattern match">^options (.*)$</ind:pattern> |
328 | | - {{% endif %}} |
| 328 | + {{% endif %}} |
329 | 329 | <ind:instance datatype="int" operation="greater than or equal">1</ind:instance> |
330 | 330 | <filter action="exclude">state_grub2_rescue_entry_for_{{{ _RULE_ID }}}</filter> |
331 | 331 | </ind:textfilecontent54_object> |
332 | 332 |
|
333 | 333 | <ind:textfilecontent54_state id="state_grub2_rescue_entry_for_{{{ _RULE_ID }}}" version="1"> |
334 | 334 | <ind:filename operation="pattern match">.*rescue\.conf$</ind:filename> |
335 | 335 | </ind:textfilecontent54_state> |
336 | | -{{%- endif %}} |
| 336 | +{{% endif %}} |
337 | 337 |
|
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) %}} |
340 | 340 | <ind:textfilecontent54_test id="test_{{{ base_name }}}" |
341 | 341 | comment="check kernel command line parameters for {{{ ARG_NAME_VALUE }}} in {{{ path }}} for all kernels" |
342 | 342 | check="all" check_existence="all_exist" version="1"> |
|
347 | 347 | <ind:textfilecontent54_object id="object_{{{ base_name }}}" |
348 | 348 | version="1"> |
349 | 349 | <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 %}} |
352 | 352 | <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 %}} |
356 | 353 | {{% else %}} |
357 | | - {{% if numeric_comparison %}} |
| 354 | + <ind:pattern operation="pattern match">^.*/vmlinuz.*(root=.*)$</ind:pattern> |
| 355 | + {{% endif %}} |
| 356 | + {{% else %}} |
| 357 | + {{% if numeric_comparison %}} |
358 | 358 | <ind:pattern operation="pattern match">^set default_kernelopts=.*{{{ ESCAPED_ARG_NAME }}}=(\d+)</ind:pattern> |
359 | | - {{% else %}} |
| 359 | + {{% else %}} |
360 | 360 | <ind:pattern operation="pattern match">^set default_kernelopts=(.*)$</ind:pattern> |
361 | | - {{% endif %}} |
362 | 361 | {{% endif %}} |
| 362 | + {{% endif %}} |
363 | 363 | <ind:instance datatype="int" operation="greater than or equal">1</ind:instance> |
364 | 364 | </ind:textfilecontent54_object> |
365 | | -{{%- endmacro %}} |
| 365 | + {{%- endmacro %}} |
366 | 366 |
|
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 %}} |
372 | 372 |
|
373 | 373 | {{% if system_with_expanded_kernel_options_in_loader_entries_or_with_options_in_grubenv %}} |
374 | 374 | <ind:textfilecontent54_state id="state_grub2_{{{ SANITIZED_ARG_NAME }}}_argument_is_kernelopts" |
|
382 | 382 | {{% if numeric_comparison %}} |
383 | 383 | <ind:textfilecontent54_state id="state_grub2_{{{ SANITIZED_ARG_NAME }}}_argument" |
384 | 384 | version="1"> |
385 | | - {{% if ARG_VARIABLE %}} |
| 385 | + {{% if ARG_VARIABLE %}} |
386 | 386 | <ind:subexpression datatype="int" operation="{{{ OPERATION }}}" |
387 | 387 | var_ref="{{{ ARG_VARIABLE }}}" /> |
388 | | - {{% else %}} |
| 388 | + {{% else %}} |
389 | 389 | <ind:subexpression datatype="int" operation="{{{ OPERATION }}}">{{{ ARG_VALUE }}}</ind:subexpression> |
390 | | - {{% endif %}} |
| 390 | + {{% endif %}} |
391 | 391 | </ind:textfilecontent54_state> |
392 | 392 | {{% if ARG_VARIABLE %}} |
393 | 393 | <external_variable comment="Variable for {{{ ARG_NAME }}}" |
|
409 | 409 | datatype="string" version="1"> |
410 | 410 | <concat> |
411 | 411 | <literal_component>^(?:.*\s)?{{{ ARG_NAME }}}=</literal_component> |
412 | | - {{% if IS_SUBSTRING == "true" %}} |
| 412 | + {{% if IS_SUBSTRING == "true" %}} |
413 | 413 | <literal_component>\S*</literal_component> |
414 | | - {{% endif %}} |
| 414 | + {{% endif %}} |
415 | 415 | <variable_component var_ref="{{{ ARG_VARIABLE }}}" /> |
416 | | - {{% if IS_SUBSTRING == "true" %}} |
| 416 | + {{% if IS_SUBSTRING == "true" %}} |
417 | 417 | <literal_component>\S*</literal_component> |
418 | | - {{% endif %}} |
| 418 | + {{% endif %}} |
419 | 419 | <literal_component>(?:\s.*)?$</literal_component> |
420 | 420 | </concat> |
421 | 421 | </local_variable> |
|
434 | 434 | <ind:textfilecontent54_object id="object_grub2_{{{ SANITIZED_ARG_NAME }}}_usr_lib_bootc_kargs_d" version="1"> |
435 | 435 | <ind:path>/usr/lib/bootc/kargs.d/</ind:path> |
436 | 436 | <ind:filename operation="pattern match">^.*\.toml$</ind:filename> |
437 | | - {{% if numeric_comparison %}} |
| 437 | + {{% if numeric_comparison %}} |
438 | 438 | <ind:pattern operation="pattern match">^kargs = \[.*"{{{ ESCAPED_ARG_NAME }}}=(\d+)".*\]$</ind:pattern> |
439 | | - {{% else %}} |
| 439 | + {{% else %}} |
440 | 440 | <ind:pattern operation="pattern match">^kargs = \[([^\]]+)\]$</ind:pattern> |
441 | | - {{% endif %}} |
| 441 | + {{% endif %}} |
442 | 442 | <ind:instance datatype="int" operation="greater than or equal">1</ind:instance> |
443 | 443 | </ind:textfilecontent54_object> |
444 | | -{{% if numeric_comparison %}} |
| 444 | + {{%- if numeric_comparison %}} |
445 | 445 | <ind:textfilecontent54_state id="state_grub2_{{{ SANITIZED_ARG_NAME }}}_usr_lib_bootc_kargs_d" version="1"> |
446 | 446 | {{% if ARG_VARIABLE %}} |
447 | 447 | <ind:subexpression datatype="int" operation="{{{ OPERATION }}}" |
|
450 | 450 | <ind:subexpression datatype="int" operation="{{{ OPERATION }}}">{{{ ARG_VALUE }}}</ind:subexpression> |
451 | 451 | {{% endif %}} |
452 | 452 | </ind:textfilecontent54_state> |
453 | | -{{% elif not ARG_VARIABLE %}} |
| 453 | + {{%- elif not ARG_VARIABLE %}} |
454 | 454 | <ind:textfilecontent54_state id="state_grub2_{{{ SANITIZED_ARG_NAME }}}_usr_lib_bootc_kargs_d" version="1"> |
455 | 455 | <ind:subexpression operation="pattern match">^.*"{{{ ESCAPED_ARG_NAME_VALUE }}}".*$</ind:subexpression> |
456 | 456 | </ind:textfilecontent54_state> |
457 | | -{{% else %}} |
| 457 | + {{%- else %}} |
458 | 458 | <ind:textfilecontent54_state id="state_grub2_{{{ SANITIZED_ARG_NAME }}}_usr_lib_bootc_kargs_d" version="1"> |
459 | 459 | <ind:subexpression operation="pattern match" var_ref="local_var_regex_{{{ SANITIZED_ARG_NAME }}}_{{{ ARG_VARIABLE }}}_bootc_kargs" /> |
460 | 460 | </ind:textfilecontent54_state> |
|
464 | 464 | datatype="string" version="1"> |
465 | 465 | <concat> |
466 | 466 | <literal_component>^.*"{{{ ARG_NAME }}}=</literal_component> |
467 | | - {{% if IS_SUBSTRING == "true" %}} |
| 467 | + {{% if IS_SUBSTRING == "true" %}} |
468 | 468 | <literal_component>\S*</literal_component> |
469 | | - {{% endif %}} |
| 469 | + {{% endif %}} |
470 | 470 | <variable_component var_ref="{{{ ARG_VARIABLE }}}" /> |
471 | | - {{% if IS_SUBSTRING == "true" %}} |
| 471 | + {{% if IS_SUBSTRING == "true" %}} |
472 | 472 | <literal_component>\S*</literal_component> |
473 | | - {{% endif %}} |
| 473 | + {{% endif %}} |
474 | 474 | <literal_component>".*$</literal_component> |
475 | 475 | </concat> |
476 | 476 | </local_variable> |
477 | 477 |
|
478 | 478 | <external_variable comment="Variable defining the value the argument should have" datatype="string" id="{{{ ARG_VARIABLE }}}" version="1" /> |
479 | | -{{% endif %}} |
| 479 | + {{%- endif %}} |
480 | 480 | {{% endif %}} |
481 | 481 |
|
482 | 482 | </def-group> |
0 commit comments