[pykickstart] [PATCH] Add --hibernation option for swap size specification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(ported dbc26273105573b072aef1001908dfe4ab61d643 from rhel6-branch)
(ported 9111f0e491f97f6153bbaf4f2e69d192fbe6b768 from rhel6-branch)
---
 pykickstart/commands/partition.py |   21 +++++++++++++++++++++
 pykickstart/handlers/control.py   |    6 +++---
 tests/commands/partition.py       |    5 +++++
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/pykickstart/commands/partition.py b/pykickstart/commands/partition.py
index 8f2ad25..e30f849 100644
--- a/pykickstart/commands/partition.py
+++ b/pykickstart/commands/partition.py
@@ -202,6 +202,20 @@ class F17_PartData(F14_PartData):
 
         return retval
 
+class F18_PartData(F17_PartData):
+    def __init__(self, *args, **kwargs):
+        F17_PartData.__init__(self, *args, **kwargs)
+
+        self.hibernation = kwargs.get("hibernation", False)
+
+    def _getArgsAsStr(self):
+        retval = F17_PartData._getArgsAsStr(self)
+
+        if self.hibernation:
+            retval += " --hibernation"
+
+        return retval
+
 class FC3_Partition(KickstartCommand):
     removedKeywords = KickstartCommand.removedKeywords
     removedAttrs = KickstartCommand.removedAttrs
@@ -383,3 +397,10 @@ class F17_Partition(F14_Partition):
             raise KickstartParseError(formatErrorMsg(self.lineno, msg=_("--resize requires --size to specify new size")))
 
         return retval
+
+class F18_Partition(F17_Partition):
+    def _getParser(self):
+        op = F17_Partition._getParser(self)
+        op.add_option("--hibernation", dest="hibernation", action="store_true", default=False)
+
+        return op
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 9b39b10..49baa2b 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -919,8 +919,8 @@ commandMap = {
         "multipath": multipath.FC6_MultiPath,
         "network": network.F16_Network,
         "nfs": method.F14_Method,
-        "part": partition.F17_Partition,
-        "partition": partition.F17_Partition,
+        "part": partition.F18_Partition,
+        "partition": partition.F18_Partition,
         "poweroff": reboot.FC6_Reboot,
         "raid": raid.F15_Raid,
         "reboot": reboot.FC6_Reboot,
@@ -1466,7 +1466,7 @@ dataMap = {
         "LogVolData": logvol.F17_LogVolData,
         "MultiPathData": multipath.FC6_MultiPathData,
         "NetworkData": network.F16_NetworkData,
-        "PartData": partition.F17_PartData,
+        "PartData": partition.F18_PartData,
         "RaidData": raid.F15_RaidData,
         "RepoData": repo.F15_RepoData,
         "SshPwData": sshpw.F13_SshPwData,
diff --git a/tests/commands/partition.py b/tests/commands/partition.py
index 979f0ff..6b1b7c6 100644
--- a/tests/commands/partition.py
+++ b/tests/commands/partition.py
@@ -174,5 +174,10 @@ class F17_TestCase(F14_TestCase):
         # no size
         self.assert_parse_error("part /foo --onpart=LABEL=var --resize")
 
+class F18_TestCase(F17_TestCase):
+    def runTest(self):
+        F17_TestCase.runTest(self)
+        self.assert_parse("part swap --hibernation")
+
 if __name__ == "__main__":
     unittest.main()
-- 
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux