Skip to content

Commit

Permalink
rhel10: autopart on RHEL does not support --type=btrfs
Browse files Browse the repository at this point in the history
Add RHEL10 version based on F38, but with the check to return an error
if btrfs is selected. Also add a test.
  • Loading branch information
bcl committed Apr 2, 2024
1 parent 37791b7 commit 86b99e8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
33 changes: 33 additions & 0 deletions pykickstart/commands/autopart.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,3 +597,36 @@ def parse(self, args):
raise KickstartParseError(msg, lineno=self.lineno)

return retval

class RHEL10_AutoPart(F38_AutoPart):
removedKeywords = F38_AutoPart.removedKeywords
removedAttrs = F38_AutoPart.removedAttrs

def parse(self, args):
# call the overriden command to do it's job first
retval = F38_AutoPart.parse(self, args)

# btrfs is no more supported
if self._typeAsStr() == "btrfs":
raise KickstartParseError(_("autopart --type=btrfs is not supported"),
lineno=self.lineno)

return retval

def _getParser(self):
"Only necessary for the type change documentation"
op = F38_AutoPart._getParser(self)
for action in op._actions:
if "--type" in action.option_strings:
action.help += """
.. versionchanged:: %s
Partitioning scheme 'btrfs' was removed.""" % versionToLongString(RHEL8)
if "--fstype" in action.option_strings:
action.help += """
.. versionchanged:: %s
Partitioning scheme 'btrfs' was removed.""" % versionToLongString(RHEL8)
return op
2 changes: 1 addition & 1 deletion pykickstart/handlers/rhel10.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class RHEL10Handler(BaseHandler):
"auth": commands.authconfig.F35_Authconfig, # RemovedCommand
"authconfig": commands.authconfig.F35_Authconfig, # RemovedCommand
"authselect": commands.authselect.F28_Authselect,
"autopart": commands.autopart.F38_AutoPart,
"autopart": commands.autopart.RHEL10_AutoPart,
"autostep": commands.autostep.F40_Autostep, # RemovedCommand
"bootloader": commands.bootloader.F39_Bootloader,
"btrfs": commands.btrfs.RHEL10_BTRFS,
Expand Down
7 changes: 6 additions & 1 deletion tests/commands/autopart.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def runTest(self):
self.assert_parse("autopart --type=lvm",
"autopart --type=lvm\n")

if self.__class__.__name__ != "RHEL8_TestCase":
if self.__class__.__name__ not in ["RHEL8_TestCase", "RHEL10_TestCase"]:
self.assert_parse("autopart --type=btrfs",
"autopart --type=btrfs\n")

Expand Down Expand Up @@ -355,5 +355,10 @@ def runTest(self):
"autopart --hibernation\n")
self.assert_parse_error("autopart --hibernation --noswap")

class RHEL10_TestCase(F38_TestCase):
def runTest(self):
F38_TestCase.runTest(self)
self.assert_parse_error("autopart --type=btrfs")

if __name__ == "__main__":
unittest.main()

0 comments on commit 86b99e8

Please sign in to comment.