stages(kickstart): ensure clearpart dict always has an option set
This commit is contained in:
parent
cce0eeaba4
commit
be85b2342c
2 changed files with 8 additions and 2 deletions
|
|
@ -139,6 +139,13 @@ SCHEMA = r"""
|
|||
"clearpart": {
|
||||
"description": "Removes partitions from the system, prior to creation of new partitions",
|
||||
"type": "object",
|
||||
"anyOf": [
|
||||
{"required": ["all"]},
|
||||
{"required": ["drives"]},
|
||||
{"required": ["list"]},
|
||||
{"required": ["disklabel"]},
|
||||
{"required": ["linux"]}
|
||||
],
|
||||
"properties": {
|
||||
"all": {
|
||||
"description": "Erases all partitions from the system",
|
||||
|
|
|
|||
|
|
@ -55,8 +55,6 @@ from osbuild.testutil.imports import import_module_from_path
|
|||
'sshkey --username someusr "ssh-rsa not-really-a-real-key"'
|
||||
),
|
||||
({"zerombr": "true"}, "zerombr"),
|
||||
# no clearpart for an empty dict (will not do anything with options anyway)
|
||||
({"clearpart": {}}, ""),
|
||||
({"clearpart": {"all": True}}, "clearpart --all"),
|
||||
({"clearpart": {"drives": ["hda", "hdb"]}}, "clearpart --drives=hda,hdb",),
|
||||
({"clearpart": {"drives": ["hda"]}}, "clearpart --drives=hda"),
|
||||
|
|
@ -120,6 +118,7 @@ def test_kickstart(tmp_path, test_input, expected):
|
|||
@pytest.mark.parametrize("test_data,expected_err", [
|
||||
# BAD pattern, ensure some obvious ways to write arbitrary
|
||||
# kickstart files will not work
|
||||
({"clearpart": {}}, "{} is not valid "),
|
||||
({"clearpart": {"disklabel": r"\n%pre\necho p0wnd"}}, r"p0wnd' does not match"),
|
||||
({"clearpart": {"drives": [" --spaces-dashes-not-allowed"]}}, "' --spaces-dashes-not-allowed' does not match"),
|
||||
({"clearpart": {"drives": ["\n%pre not allowed"]}}, "not allowed' does not match"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue