Skip to content

Commit 4167da0

Browse files
committed
Modify grub2_bootloader_argument OVAL template to support numeric comparison
- See inline documentation in the oval.template for more details. - Test scenarios now use TEST_CORRECT_VALUE/TEST_WRONG_VALUE instead of hardcoded strings. - Two new numeric test scenarios added: arg_value_meets_minimal.pass.sh and arg_value_below_minimal.fail.sh.
1 parent 4a538ba commit 4167da0

22 files changed

+412
-102
lines changed

shared/templates/grub2_bootloader_argument/oval.template

Lines changed: 331 additions & 59 deletions
Large diffs are not rendered by default.

shared/templates/grub2_bootloader_argument/tests/arg_not_in_entries.fail.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# packages = grub2,grubby
55

66
{{%- if ARG_VARIABLE %}}
7-
# variables = {{{ ARG_VARIABLE }}}=correct_value
8-
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=correct_value" %}}
7+
# variables = {{{ ARG_VARIABLE }}}={{{ TEST_CORRECT_VALUE }}}
8+
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=" ~ TEST_CORRECT_VALUE %}}
99
{{%- endif %}}
1010

1111
source common.sh

shared/templates/grub2_bootloader_argument/tests/arg_not_in_etcdefaultgrub.fail.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# platform = multi_platform_all
44

55
{{%- if ARG_VARIABLE %}}
6-
# variables = {{{ ARG_VARIABLE }}}=correct_value
7-
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=correct_value" %}}
6+
# variables = {{{ ARG_VARIABLE }}}={{{ TEST_CORRECT_VALUE }}}
7+
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=" ~ TEST_CORRECT_VALUE %}}
88
{{%- endif %}}
99

1010
source common.sh

shared/templates/grub2_bootloader_argument/tests/arg_not_in_etcdefaultgrub_recovery_disabled.fail.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
# platform = multi_platform_all
44
{{%- if ARG_VARIABLE %}}
5-
# variables = {{{ ARG_VARIABLE }}}=correct_value
6-
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=correct_value" %}}
5+
# variables = {{{ ARG_VARIABLE }}}={{{ TEST_CORRECT_VALUE }}}
6+
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=" ~ TEST_CORRECT_VALUE %}}
77
{{%- endif %}}
88

99
source common.sh

shared/templates/grub2_bootloader_argument/tests/arg_not_in_grubenv_and_not_referenced.pass.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# packages = grub2,grubby
55

66
{{%- if ARG_VARIABLE %}}
7-
# variables = {{{ ARG_VARIABLE }}}=correct_value
8-
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=correct_value" %}}
7+
# variables = {{{ ARG_VARIABLE }}}={{{ TEST_CORRECT_VALUE }}}
8+
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=" ~ TEST_CORRECT_VALUE %}}
99
{{%- endif %}}
1010

1111
source common.sh

shared/templates/grub2_bootloader_argument/tests/arg_not_in_grubenv_but_referenced.fail.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# platform = Oracle Linux 8,Red Hat Enterprise Linux 8
44
# packages = grub2,grubby
55
{{%- if ARG_VARIABLE %}}
6-
# variables = {{{ ARG_VARIABLE }}}=correct_value
7-
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=correct_value" %}}
6+
# variables = {{{ ARG_VARIABLE }}}={{{ TEST_CORRECT_VALUE }}}
7+
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=" ~ TEST_CORRECT_VALUE %}}
88
{{%- endif %}}
99

1010
source common.sh
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
{{% if OPERATION == "pattern match" %}}
4+
# platform = Not Applicable
5+
{{% else %}}
6+
# platform = multi_platform_all
7+
{{% endif %}}
8+
{{%- if 'ubuntu' in product %}}
9+
# packages = grub2
10+
{{%- else %}}
11+
# packages = grub2,grubby
12+
{{%- endif %}}
13+
{{%- if ARG_VARIABLE %}}
14+
# variables = {{{ ARG_VARIABLE }}}={{{ TEST_CORRECT_VALUE }}}
15+
{{% endif %}}
16+
17+
source common.sh
18+
19+
{{{ grub2_bootloader_argument_remediation(ARG_NAME, ARG_NAME ~ "=" ~ TEST_WRONG_VALUE) }}}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
{{% if OPERATION == "pattern match" %}}
4+
# platform = Not Applicable
5+
{{% else %}}
6+
# platform = multi_platform_all
7+
{{% endif %}}
8+
{{%- if 'ubuntu' in product %}}
9+
# packages = grub2
10+
{{%- else %}}
11+
# packages = grub2,grubby
12+
{{%- endif %}}
13+
{{%- if ARG_VARIABLE %}}
14+
# variables = {{{ ARG_VARIABLE }}}={{{ TEST_CORRECT_VALUE }}}
15+
{{% endif %}}
16+
17+
source common.sh
18+
19+
{{{ grub2_bootloader_argument_remediation(ARG_NAME, ARG_NAME ~ "=" ~ TEST_CORRECT_VALUE) }}}

shared/templates/grub2_bootloader_argument/tests/correct_recovery_disabled.pass.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
# packages = grub2,grubby
88
{{%- endif %}}
99
{{%- if ARG_VARIABLE %}}
10-
# variables = {{{ ARG_VARIABLE }}}=correct_value
11-
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=correct_value" %}}
10+
# variables = {{{ ARG_VARIABLE }}}={{{ TEST_CORRECT_VALUE }}}
11+
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=" ~ TEST_CORRECT_VALUE %}}
1212
{{%- endif %}}
1313

1414
source common.sh

shared/templates/grub2_bootloader_argument/tests/correct_value_etcdefault_dir_noupdate.fail.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# packages = grub2
55

66
{{%- if ARG_VARIABLE %}}
7-
# variables = {{{ ARG_VARIABLE }}}=correct_value
8-
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=correct_value" %}}
7+
# variables = {{{ ARG_VARIABLE }}}={{{ TEST_CORRECT_VALUE }}}
8+
{{%- set ARG_NAME_VALUE= ARG_NAME ~ "=" ~ TEST_CORRECT_VALUE %}}
99
{{%- endif %}}
1010

1111
# Clean up

0 commit comments

Comments
 (0)