From 3595b07df513a52b3aeb717b8dc2ba98fca937a1 Mon Sep 17 00:00:00 2001 From: James Laska Date: Thu, 19 Feb 2009 16:50:38 -0500 Subject: Allow importing s390 distros --- cobbler/action_import.py | 14 ++++++++------ cobbler/utils.py | 8 ++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cobbler/action_import.py b/cobbler/action_import.py index 93593c9e..48f4b112 100644 --- a/cobbler/action_import.py +++ b/cobbler/action_import.py @@ -88,8 +88,8 @@ class Importer: if self.arch == "x86": # be consistent self.arch = "i386" - if self.arch not in [ "i386", "ia64", "ppc", "ppc64", "s390x", "x86_64", ]: - raise CX(_("arch must be i386, ia64, ppc, ppc64, s390x or x86_64")) + if self.arch not in [ "i386", "ia64", "ppc", "ppc64", "s390", "s390x", "x86_64", ]: + raise CX(_("arch must be i386, ia64, ppc, ppc64, s390, s390x or x86_64")) # if we're going to do any copying, set where to put things # and then make sure nothing is already there. @@ -113,7 +113,7 @@ class Importer: if self.arch: # append the arch path to the name if the arch is not already # found in the name. - for x in [ "i386", "ia64", "ppc", "ppc64", "s390x", "x86_64", "x86", ]: + for x in [ "i386", "ia64", "ppc", "ppc64", "s390", "s390x", "x86_64", "x86", ]: if self.mirror_name.lower().find(x) != -1: if self.arch != x : raise CX(_("Architecture found on pathname (%s) does not fit the one given in command line (%s)")%(x,self.arch)) @@ -519,7 +519,7 @@ class Importer: print "- following symlink: %s" % fullname os.path.walk(fullname, self.distro_adder, foo) - if x.startswith("initrd") or x.startswith("ramdisk.image.gz"): + if ( x.startswith("initrd") or x.startswith("ramdisk.image.gz") ) and x != "initrd.size": initrd = os.path.join(dirname,x) if ( x.startswith("vmlinuz") or x.startswith("kernel.img") ) and x.find("initrd") == -1: kernel = os.path.join(dirname,x) @@ -774,7 +774,7 @@ class Importer: name = name.replace("chrp","ppc64") for separator in [ '-' , '_' , '.' ] : - for arch in [ "i386" , "x86_64" , "ia64" , "ppc64", "ppc32", "ppc", "x86" , "s390x" , "386" , "amd" ]: + for arch in [ "i386" , "x86_64" , "ia64" , "ppc64", "ppc32", "ppc", "x86" , "s390", "s390x" , "386" , "amd" ]: name = name.replace("%s%s" % ( separator , arch ),"") return name @@ -793,6 +793,8 @@ class Importer: if dirname.find("i386") != -1 or dirname.find("386") != -1 or dirname.find("x86") != -1: return "i386" if dirname.find("s390") != -1: + return "s390" + if dirname.find("s390x") != -1: return "s390x" if dirname.find("ppc64") != -1 or dirname.find("chrp") != -1: return "ppc64" @@ -915,7 +917,7 @@ class BaseImporter: for x in fnames: if self.match_kernelarch_file(x): # print _("- kernel header found: %s") % x - for arch in [ "i386" , "x86_64" , "ia64" , "ppc64", "ppc", "s390x" ]: + for arch in [ "i386" , "x86_64" , "ia64" , "ppc64", "ppc", "s390", "s390x" ]: if x.find(arch) != -1: foo[arch] = 1 for arch in [ "i686" , "amd64" ]: diff --git a/cobbler/utils.py b/cobbler/utils.py index 3e32e2d8..1a566694 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -459,11 +459,11 @@ def blender(api_handle,remove_hashes, root_obj): # hack -- s390 nodes get additional default kernel options arch = results.get("arch","?") - if arch == "s390x": + if arch.startswith("s390"): keyz = settings.kernel_options_s390x.keys() for k in keyz: if not results.has_key(k): - results[k] = settings.kernel_options_s390x[k] + results["kernel_options"][k] = settings.kernel_options_s390x[k] # determine if we have room to add kssendmac to the kernel options line kernel_txt = hash_to_string(results["kernel_options"]) @@ -1048,13 +1048,13 @@ def set_redhat_management_key(self,key): def set_arch(self,arch): if arch is None or arch == "": arch = "x86" - if arch in [ "standard", "ia64", "x86", "i386", "ppc", "ppc64", "x86_64", "s390x" ]: + if arch in [ "standard", "ia64", "x86", "i386", "ppc", "ppc64", "x86_64", "s390", "s390x" ]: if arch == "x86" or arch == "standard": # be consistent arch = "i386" self.arch = arch return True - raise CX(_("arch choices include: x86, x86_64, ppc, ppc64, s390x and ia64")) + raise CX(_("arch choices include: x86, x86_64, ppc, ppc64, s390, s390x and ia64")) def set_os_version(self,os_version): if os_version == "" or os_version is None: -- cgit