stages(kickstart): implement "display_mode" option(s)
This implements the display mode options `text`, `graphical`, `cmdline` as an enum with the name `display_mode`. See PR#1442 for the rational/discussion of this over using three boolean options. Thanks to Achilleas and Tom!
This commit is contained in:
parent
2c41bcde68
commit
c9d42865ed
2 changed files with 11 additions and 1 deletions
|
|
@ -198,6 +198,10 @@ SCHEMA = r"""
|
|||
}
|
||||
}
|
||||
}]
|
||||
},
|
||||
"display_mode": {
|
||||
"description": "Perform the Kickstart installation in the given display mode",
|
||||
"enum": ["text", "graphical", "cmdline"]
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
|
@ -342,6 +346,9 @@ def main(tree, options):
|
|||
clearpart = make_clearpart(options)
|
||||
if clearpart:
|
||||
config += [clearpart]
|
||||
display_mode = options.get("display_mode")
|
||||
if display_mode:
|
||||
config += [display_mode]
|
||||
|
||||
reboot = make_reboot(options)
|
||||
if reboot:
|
||||
|
|
|
|||
|
|
@ -98,13 +98,15 @@ TEST_INPUT = [
|
|||
},
|
||||
"lang en_US.UTF-8\nkeyboard us\ntimezone UTC\nzerombr\nclearpart --all --drives=sd*|hd*|vda,/dev/vdc",
|
||||
),
|
||||
# no reboot for an empty dict
|
||||
({"reboot": True}, "reboot"),
|
||||
({"reboot": {"eject": False}}, "reboot"),
|
||||
({"reboot": {"eject": True}}, "reboot --eject"),
|
||||
({"reboot": {"kexec": False}}, "reboot"),
|
||||
({"reboot": {"kexec": True}}, "reboot --kexec"),
|
||||
({"reboot": {"eject": True, "kexec": True}}, "reboot --eject --kexec"),
|
||||
({"display_mode": "text"}, "text"),
|
||||
({"display_mode": "graphical"}, "graphical"),
|
||||
({"display_mode": "cmdline"}, "cmdline"),
|
||||
]
|
||||
|
||||
|
||||
|
|
@ -183,6 +185,7 @@ def test_kickstart_valid(tmp_path, test_input, expected): # pylint: disable=unu
|
|||
({"reboot": {}}, "{} is not valid under any of the given schemas"),
|
||||
({"reboot": "random-string"}, "'random-string' is not valid "),
|
||||
({"reboot": {"random": "option"}}, "{'random': 'option'} is not valid "),
|
||||
({"display_mode": "invalid-mode"}, "'invalid-mode' is not one of "),
|
||||
],
|
||||
)
|
||||
def test_schema_validation_bad_apples(test_data, expected_err):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue