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

[pykickstart 1/2] repo: new parameter '--trustedssl'.



---
 pykickstart/commands/repo.py    |   26 ++++++++++++++++++++++++++
 pykickstart/handlers/control.py |    8 ++++----
 tests/commands/repo.py          |    9 +++++++++
 3 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/pykickstart/commands/repo.py b/pykickstart/commands/repo.py
index 521aeb3..933cbc7 100644
--- a/pykickstart/commands/repo.py
+++ b/pykickstart/commands/repo.py
@@ -108,6 +108,22 @@ class F13_RepoData(F11_RepoData):
 
         return retval
 
+class RHEL6_RepoData(F13_RepoData):
+    removedKeywords = F13_RepoData.removedKeywords
+    removedAttrs = F13_RepoData.removedAttrs
+
+    def __init__(self, *args, **kwargs):
+        F13_RepoData.__init__(self, *args, **kwargs)
+        self.trustedssl = kwargs.get("trustedssl", False)
+
+    def _getArgsAsStr(self):
+        retval = F13_RepoData._getArgsAsStr(self)
+
+        if self.trustedssl:
+            retval += " --trustedssl"
+
+        return retval
+
 class FC6_Repo(KickstartCommand):
     removedKeywords = KickstartCommand.removedKeywords
     removedAttrs = KickstartCommand.removedAttrs
@@ -209,3 +225,13 @@ class F13_Repo(F11_Repo):
         op = F11_Repo._getParser(self)
         op.add_option("--proxy")
         return op
+
+class RHEL6_Repo(F13_Repo):
+    removedKeywords = F13_Repo.removedKeywords
+    removedAttrs = F13_Repo.removedAttrs
+
+    def _getParser(self):
+        op = F13_Repo._getParser(self)
+        op.add_option("--trustedssl", action="store_true", default=False)
+        return op
+
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index fd8860e..23a5a77 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -691,7 +691,7 @@ commandMap = {
         "poweroff": reboot.FC6_Reboot,
         "raid": raid.F14_Raid,
         "reboot": reboot.FC6_Reboot,
-        "repo": repo.F13_Repo,
+        "repo": repo.RHEL6_Repo,
         "rescue": rescue.F10_Rescue,
         "rootpw": rootpw.F8_RootPw,
         "selinux": selinux.FC3_SELinux,
@@ -912,7 +912,7 @@ commandMap = {
         "poweroff": reboot.FC6_Reboot,
         "raid": raid.F13_Raid,
         "reboot": reboot.FC6_Reboot,
-        "repo": repo.F13_Repo,
+        "repo": repo.RHEL6_Repo,
         "rescue": rescue.F10_Rescue,
         "rootpw": rootpw.F8_RootPw,
         "selinux": selinux.FC3_SELinux,
@@ -1103,7 +1103,7 @@ dataMap = {
         "NetworkData": network.F8_NetworkData,
         "PartData": partition.F14_PartData,
         "RaidData": raid.F14_RaidData,
-        "RepoData": repo.F13_RepoData,
+        "RepoData": repo.RHEL6_RepoData,
         "SshPwData": sshpw.F13_SshPwData,
         "UserData": user.F12_UserData,
         "VolGroupData": volgroup.FC3_VolGroupData,
@@ -1153,7 +1153,7 @@ dataMap = {
         "NetworkData": network.F8_NetworkData,
         "PartData": partition.F12_PartData,
         "RaidData": raid.F13_RaidData,
-        "RepoData": repo.F13_RepoData,
+        "RepoData": repo.RHEL6_RepoData,
         "SshPwData": sshpw.F13_SshPwData,
         "UserData": user.F12_UserData,
         "VolGroupData": volgroup.FC3_VolGroupData,
diff --git a/tests/commands/repo.py b/tests/commands/repo.py
index 06a3a9b..27c3140 100644
--- a/tests/commands/repo.py
+++ b/tests/commands/repo.py
@@ -98,5 +98,14 @@ class F13_TestCase(F11_TestCase):
         self.assert_parse_error("repo --name=blah --baseurl=www.domain.com --proxy",
                                 KickstartParseError)
 
+class RHEL6_TestCase(F13_TestCase):
+    def runTest(self):
+        F13_TestCase.runTest(self)        
+        #pass
+        self.assert_parse("repo --name=blah --baseurl=https://www.domain.com --trustedssl")
+        #fail
+        self.assert_parse_error("repo --name=blah --baseurl=https://www.domain.com --trustedssl=yeeeaah", KickstartParseError)
+        
+
 if __name__ == "__main__":
     unittest.main()
-- 
1.7.1


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