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

[pykickstart 2/2] method: new parameter '--trustedssl' after --url.



---
 pykickstart/commands/method.py  |   26 ++++++++++++++++++++++++++
 pykickstart/handlers/control.py |   16 ++++++++--------
 tests/commands/method.py        |   12 ++++++++++++
 3 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/pykickstart/commands/method.py b/pykickstart/commands/method.py
index d37f19f..5151bb2 100644
--- a/pykickstart/commands/method.py
+++ b/pykickstart/commands/method.py
@@ -156,3 +156,29 @@ class F13_Method(FC6_Method):
             op.add_option("--proxy")
 
         return op
+
+class RHEL6_Method(F13_Method):
+    removedKeywords = F13_Method.removedKeywords
+    removedAttrs = F13_Method.removedAttrs    
+
+    def __init__(self, *args, **kwargs):
+        F13_Method.__init__(self, *args, **kwargs)
+
+        self.trustedssl = False
+
+    def __str__(self):
+        retval = F13_Method.__str__(self)
+
+        if self.method == "url" and self.trustedssl:
+            retval = retval.strip()
+            retval += " --trustedssl"
+
+        return retval
+
+    def _getParser(self):
+        op = F13_Method._getParser(self)
+
+        if self.currentCmd == "url":
+            op.add_option("--trustedssl", action="store_true", default=False)
+
+        return op
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 23a5a77..6f98a9d 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -657,7 +657,7 @@ commandMap = {
         "autopart": autopart.F12_AutoPart,
         "autostep": autostep.FC3_AutoStep,
         "bootloader": bootloader.F14_Bootloader,
-        "cdrom": method.F13_Method,
+        "cdrom": method.RHEL6_Method,
         "clearpart": clearpart.FC3_ClearPart,
         "cmdline": displaymode.FC3_DisplayMode,
         "device": device.F8_Device,
@@ -670,7 +670,7 @@ commandMap = {
         "graphical": displaymode.FC3_DisplayMode,
         "group": group.F12_Group,
         "halt": reboot.FC6_Reboot,
-        "harddrive": method.F13_Method,
+        "harddrive": method.RHEL6_Method,
         "ignoredisk": ignoredisk.F14_IgnoreDisk,
         "install": upgrade.F11_Upgrade,
         "interactive": interactive.FC3_Interactive,
@@ -685,7 +685,7 @@ commandMap = {
         "monitor": monitor.F10_Monitor,
         "multipath": multipath.FC6_MultiPath,
         "network": network.F9_Network,
-        "nfs": method.F13_Method,
+        "nfs": method.RHEL6_Method,
         "part": partition.F14_Partition,
         "partition": partition.F14_Partition,
         "poweroff": reboot.FC6_Reboot,
@@ -703,7 +703,7 @@ commandMap = {
         "timezone": timezone.FC6_Timezone,
         "updates": updates.F7_Updates,
         "upgrade": upgrade.F11_Upgrade,
-        "url": method.F13_Method,
+        "url": method.RHEL6_Method,
         "user": user.F12_User,
         "vnc": vnc.F9_Vnc,
         "volgroup": volgroup.FC3_VolGroup,
@@ -878,7 +878,7 @@ commandMap = {
         "autopart": autopart.F12_AutoPart,
         "autostep": autostep.FC3_AutoStep,
         "bootloader": bootloader.F12_Bootloader,
-        "cdrom": method.F13_Method,
+        "cdrom": method.RHEL6_Method,
         "clearpart": clearpart.FC3_ClearPart,
         "cmdline": displaymode.FC3_DisplayMode,
         "device": device.F8_Device,
@@ -891,7 +891,7 @@ commandMap = {
         "graphical": displaymode.FC3_DisplayMode,
         "group": group.F12_Group,
         "halt": reboot.FC6_Reboot,
-        "harddrive": method.F13_Method,
+        "harddrive": method.RHEL6_Method,
         "ignoredisk": ignoredisk.RHEL6_IgnoreDisk,
         "install": upgrade.F11_Upgrade,
         "interactive": interactive.FC3_Interactive,
@@ -906,7 +906,7 @@ commandMap = {
         "monitor": monitor.F10_Monitor,
         "multipath": multipath.FC6_MultiPath,
         "network": network.F9_Network,
-        "nfs": method.F13_Method,
+        "nfs": method.RHEL6_Method,
         "part": partition.F12_Partition,
         "partition": partition.F12_Partition,
         "poweroff": reboot.FC6_Reboot,
@@ -924,7 +924,7 @@ commandMap = {
         "timezone": timezone.FC6_Timezone,
         "updates": updates.F7_Updates,
         "upgrade": upgrade.F11_Upgrade,
-        "url": method.F13_Method,
+        "url": method.RHEL6_Method,
         "user": user.F12_User,
         "vnc": vnc.F9_Vnc,
         "volgroup": volgroup.FC3_VolGroup,
diff --git a/tests/commands/method.py b/tests/commands/method.py
index f73d4e4..09d0279 100644
--- a/tests/commands/method.py
+++ b/tests/commands/method.py
@@ -100,5 +100,17 @@ class F13_TestCase(FC6_TestCase):
         self.assert_parse_error("url --url=http://someplace/somewhere --proxy", KickstartParseError)
         self.assert_parse_error("url --proxy=http://someplace/somewhere";, KickstartValueError)
 
+class RHEL6_TestCase(F13_TestCase):
+    def runTest(self):
+        # run FC6 test case
+        F13_TestCase.runTest(self)
+
+        # pass
+        self.assert_parse("url --url=https://someplace/somewhere --trustedssl")
+
+        # fail
+        self.assert_parse_error("cdrom --trustedssl", KickstartParseError)
+
+
 if __name__ == "__main__":
     unittest.main()
-- 
1.7.1


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