diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2009-02-27 17:57:32 -0500 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2009-02-27 17:57:32 -0500 |
commit | 847f4da4ba03fa23e50509bed607a2ea5011ac09 (patch) | |
tree | e33b5f7843f9755b6833e4d7351fea055711def8 /cobbler | |
parent | 12f11d7a3232d0c0adb82f24522adec6ca06833e (diff) | |
download | cobbler-847f4da4ba03fa23e50509bed607a2ea5011ac09.tar.gz cobbler-847f4da4ba03fa23e50509bed607a2ea5011ac09.tar.xz cobbler-847f4da4ba03fa23e50509bed607a2ea5011ac09.zip |
Allow src and noarch in API and webapp for repos, make the set_repo function smarter.
Conflicts:
cobbler/utils.py
Diffstat (limited to 'cobbler')
-rw-r--r-- | cobbler/item_repo.py | 3 | ||||
-rw-r--r-- | cobbler/utils.py | 20 |
2 files changed, 14 insertions, 9 deletions
diff --git a/cobbler/item_repo.py b/cobbler/item_repo.py index c68c7787..02622004 100644 --- a/cobbler/item_repo.py +++ b/cobbler/item_repo.py @@ -83,6 +83,7 @@ class Repo(item.Item): self.set_mirror_locally(self.mirror_locally) self.set_owners(self.owners) self.set_environment(self.environment) + self.set_arch(self.arch) self._guess_breed() self.uid = self.load_item(seed_data,'uid','') @@ -198,7 +199,7 @@ class Repo(item.Item): """ Override the arch used for reposync """ - return utils.set_arch(self,arch) + return utils.set_arch(self,arch,repo=True) def is_valid(self): """ diff --git a/cobbler/utils.py b/cobbler/utils.py index dc9e043d..8f4cebaa 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -1045,16 +1045,20 @@ def set_redhat_management_key(self,key): self.redhat_management_key = key return True -def set_arch(self,arch): - if arch is None or arch == "": - arch = "x86" - if arch in [ "standard", "ia64", "x86", "i386", "ppc", "ppc64", "x86_64", "s390", "s390x" ]: - if arch == "x86" or arch == "standard": - # be consistent - arch = "i386" +def set_arch(self,arch,repo=False): + if arch is None or arch == "" or arch == "standard" or arch == "x86": + arch = "i386" + + if repo: + valids = [ "i386", "x86_64", "ia64", "ppc", "ppc64", "s390", "s390x", "noarch", "src" ] + else: + valids = [ "i386", "x86_64", "ia64", "ppc", "ppc64", "s390", "s390x" ] + + if arch in valids: self.arch = arch return True - raise CX(_("arch choices include: x86, x86_64, ppc, ppc64, s390, s390x and ia64")) + + raise CX("arch choices include: %s" % ", ".join(valids)) def set_os_version(self,os_version): if os_version == "" or os_version is None: |