From 3715ffd8f09cec74c41e66330cb04d4fbf4ff5be Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 23 Jul 2014 17:12:11 -0700 Subject: [PATCH] Add --install flag to repo command (#1119867) Related: rhbz#1119867 --- pykickstart/commands/repo.py | 25 +++++++++++++++++++++++++ pykickstart/handlers/control.py | 4 ++-- tests/commands/repo.py | 10 ++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/pykickstart/commands/repo.py b/pykickstart/commands/repo.py index 77b0c96..ede91a9 100644 --- a/pykickstart/commands/repo.py +++ b/pykickstart/commands/repo.py @@ -133,6 +133,22 @@ RHEL6_RepoData = F14_RepoData F15_RepoData = F14_RepoData +class RHEL7_RepoData(F14_RepoData): + removedKeywords = F14_RepoData.removedKeywords + removedAttrs = F14_RepoData.removedAttrs + + def __init__(self, *args, **kwargs): + F14_RepoData.__init__(self, *args, **kwargs) + self.install = kwargs.get("install", False) + + def _getArgsAsStr(self): + retval = F14_RepoData._getArgsAsStr(self) + + if self.install: + retval += " --install" + + return retval + class FC6_Repo(KickstartCommand): removedKeywords = KickstartCommand.removedKeywords removedAttrs = KickstartCommand.removedAttrs @@ -253,3 +269,12 @@ class F15_Repo(F14_Repo): removedAttrs = F14_Repo.removedAttrs urlRequired = False + +class RHEL7_Repo(F15_Repo): + removedKeywords = F15_Repo.removedKeywords + removedAttrs = F15_Repo.removedAttrs + + def _getParser(self): + op = F15_Repo._getParser(self) + op.add_option("--install", action="store_true", default=False) + return op diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py index 04464d0..6b2e413 100644 --- a/pykickstart/handlers/control.py +++ b/pykickstart/handlers/control.py @@ -1356,7 +1356,7 @@ commandMap = { "raid": raid.F20_Raid, "realm": realm.F19_Realm, "reboot": reboot.F18_Reboot, - "repo": repo.F15_Repo, + "repo": repo.RHEL7_Repo, "rescue": rescue.F10_Rescue, "rootpw": rootpw.F18_RootPw, "selinux": selinux.FC3_SELinux, @@ -1728,7 +1728,7 @@ dataMap = { "NetworkData": network.RHEL7_NetworkData, "PartData": partition.F18_PartData, "RaidData": raid.F18_RaidData, - "RepoData": repo.F15_RepoData, + "RepoData": repo.RHEL7_RepoData, "SshPwData": sshpw.F13_SshPwData, "UserData": user.F19_UserData, "VolGroupData": volgroup.FC16_VolGroupData, diff --git a/tests/commands/repo.py b/tests/commands/repo.py index a1f4211..d45b7d5 100644 --- a/tests/commands/repo.py +++ b/tests/commands/repo.py @@ -112,5 +112,15 @@ class F15_TestCase(F14_TestCase): def runTest(self, urlRequired=False): F14_TestCase.runTest(self, urlRequired=urlRequired) +class RHEL7_TestCase(F15_TestCase): + def runTest(self, urlRequired=False): + F15_TestCase.runTest(self, urlRequired=urlRequired) + #pass + self.assert_parse("repo --name=blah --baseurl=https://www.domain.com --install", + "repo --name=\"blah\" --baseurl=https://www.domain.com --install\n") + #fail + self.assert_parse_error("repo --name=blah --baseurl=https://www.domain.com --install=yeeeaah", KickstartParseError) + + if __name__ == "__main__": unittest.main() -- 2.11.4.GIT