summaryrefslogtreecommitdiffstats
path: root/cobbler
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2009-02-24 11:21:36 -0500
committerMichael DeHaan <mdehaan@redhat.com>2009-02-24 11:21:36 -0500
commit37fa19a9132392a4055903a849c2d4794864d958 (patch)
treef1368080b903d6c0de40c3210783fee862321e55 /cobbler
parent5acf95beb26437ba568211f39d2d48670721a787 (diff)
parent1fc61f9c98a00f6bb56721e77d07fa577f92cb46 (diff)
downloadcobbler-37fa19a9132392a4055903a849c2d4794864d958.tar.gz
cobbler-37fa19a9132392a4055903a849c2d4794864d958.tar.xz
cobbler-37fa19a9132392a4055903a849c2d4794864d958.zip
Merge commit 'jlaska/devel' into devel
Diffstat (limited to 'cobbler')
-rw-r--r--cobbler/action_import.py14
-rw-r--r--cobbler/pxegen.py65
-rw-r--r--cobbler/utils.py10
3 files changed, 45 insertions, 44 deletions
diff --git a/cobbler/action_import.py b/cobbler/action_import.py
index f5bd557d..3de63b98 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("vmlinu") 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/pxegen.py b/cobbler/pxegen.py
index 262649f1..e003a9d9 100644
--- a/cobbler/pxegen.py
+++ b/cobbler/pxegen.py
@@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
import os
import os.path
import shutil
+import shlex
import time
import sys
import glob
@@ -123,8 +124,6 @@ class PXEGen:
print e.value
# FIXME: using logging module so this ends up in cobbler.log?
- if len(errors) > 0:
- raise CX(_("Error(s) encountered while copying distro files"))
def copy_images(self):
"""
@@ -141,8 +140,6 @@ class PXEGen:
print e.value
# FIXME: using logging module so this ends up in cobbler.log?
- if len(errors) > 0:
- raise CX(_("Error(s) encountered while copying image files"))
def copy_single_distro_files(self, d):
for dirtree in [self.bootloc, self.settings.webdir]:
@@ -482,25 +479,28 @@ class PXEGen:
image = profile
# hack: s390 generates files per system not per interface
- if not image_based and distro.arch == "s390x":
+ if not image_based and distro.arch.startswith("s390"):
+ # Always write a system specific _conf and _parm file
f2 = os.path.join(self.bootloc, "s390x", "s_%s" % system.name)
+ cf = "%s_conf" % f2
+ pf = "%s_parm" % f2
+ template_cf = open("/etc/cobbler/pxe/s390x_conf.template")
+ template_pf = open("/etc/cobbler/pxe/s390x_parm.template")
+ blended = utils.blender(self.api, True, system)
+ self.templar.render(template_cf, blended, cf)
+ # FIXME: profiles also need this data!
+ # FIXME: the _conf and _parm files are limited to 80 characters in length
+ kickstart_path = "http://%s/cblr/svc/op/ks/system/%s" % (blended["http_server"], system.name)
+ # gather default kernel_options and default kernel_options_s390x
+ kopts = blended.get("kernel_options","")
+ hkopts = shlex.split(utils.hash_to_string(kopts))
+ blended["kickstart_expanded"] = "ks=%s" % kickstart_path
+ blended["kernel_options"] = hkopts
+ self.templar.render(template_pf, blended, pf)
+
+ # Write system specific zPXE file if netboot_enabled?
if system.netboot_enabled:
- cf = "%s_conf" % f2
- pf = "%s_parm" % f2
- template_cf = open("/etc/cobbler/pxe/s390x_conf.template")
- template_pf = open("/etc/cobbler/pxe/s390x_parm.template")
self.write_pxe_file(f2,system,profile,distro,distro.arch)
- blended = utils.blender(self.api, True, system)
- self.templar.render(template_cf, blended, cf)
- # FIXME: profiles also need this data!
- kickstart_path = "http://%s/cblr/svc/op/ks/system/%s" % (blended["http_server"], system.name)
- meta2 = {}
- meta2["kickstart_expanded"] = "ks=%s" % kickstart_path
- ## FIXME: this may not work right for kernel options with
- ## a space in them though there are not many of those.
- meta2["kernel_options"] = "\n".join(blended["kernel_options"].split(" "))
- meta2["confname"] = "s_%s_conf" % system.name
- self.templar.render(template_pf, meta2, pf)
else:
# ensure the file doesn't exist
utils.rmfile(f2)
@@ -575,7 +575,7 @@ class PXEGen:
distro = profile.get_conceptual_parent()
if distro is None:
raise CX(_("profile is missing distribution: %s, %s") % (profile.name, profile.distro))
- if distro.arch == "s390x":
+ if distro.arch.startswith("s390"):
listfile.write("%s\n" % profile.name)
f2 = os.path.join(self.bootloc, "s390x", "p_%s" % profile.name)
self.write_pxe_file(f2,None,profile,distro,distro.arch)
@@ -586,15 +586,14 @@ class PXEGen:
blended = utils.blender(self.api, True, profile)
self.templar.render(template_cf, blended, cf)
# FIXME: profiles also need this data!
+ # FIXME: the _conf and _parm files are limited to 80 characters in length
kickstart_path = "http://%s/cblr/svc/op/ks/profile/%s" % (blended["http_server"], profile.name)
- meta2 = {}
- meta2["kickstart_expanded"] = "ks=%s" % kickstart_path
- ## FIXME: this may not work right for kernel options with
- ## a space in them though there are not many of those.
- meta2["kernel_options"] = "\n".join(blended["kernel_options"].split(" "))
- meta2["confname"] = "p_%s_conf" % profile.name
- self.templar.render(template_pf, meta2, pf)
-
+ # gather default kernel_options and default kernel_options_s390x
+ kopts = blended.get("kernel_options","")
+ hkopts = shlex.split(utils.hash_to_string(kopts))
+ blended["kickstart_expanded"] = "ks=%s" % kickstart_path
+ blended["kernel_options"] = hkopts
+ self.templar.render(template_pf, blended, pf)
listfile.close()
@@ -761,7 +760,7 @@ class PXEGen:
else:
template = os.path.join(self.settings.pxe_template_dir,"pxesystem.template")
- if arch == "s390x":
+ if arch.startswith("s390"):
template = os.path.join(self.settings.pxe_template_dir,"pxesystem_s390x.template")
elif arch == "ia64":
template = os.path.join(self.settings.pxe_template_dir,"pxesystem_ia64.template")
@@ -795,7 +794,7 @@ class PXEGen:
if distro is not None and distro.breed == "windows":
template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_win.template")
- elif arch == "s390x":
+ elif arch.startswith("s390"):
template = os.path.join(self.settings.pxe_template_dir,"pxeprofile_s390x.template")
else:
template = os.path.join(self.settings.pxe_template_dir,"pxeprofile.template")
@@ -838,14 +837,14 @@ class PXEGen:
# interface=bootif causes a failure
# append_line = append_line.replace("ksdevice","interface")
- if arch in ["s390x", "ppc", "ppc64"]:
+ if arch in ["s390", "s390x", "ppc", "ppc64"]:
# remove the prefix "append"
append_line = append_line[7:]
# store variables for templating
metadata["menu_label"] = ""
if profile:
- if not arch in [ "ia64", "ppc", "ppc64", "s390x" ]:
+ if not arch in [ "ia64", "ppc", "ppc64", "s390", "s390x" ]:
metadata["menu_label"] = "MENU LABEL %s" % profile.name
metadata["profile_name"] = profile.name
elif image:
diff --git a/cobbler/utils.py b/cobbler/utils.py
index 7f662e0d..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:
@@ -1386,7 +1386,7 @@ def popen2(args, **kwargs):
Leftovers from borrowing some bits from Snake, replace this
function with just the subprocess call.
"""
- p = sub_process.Popen(args, stdout=subprocess.PIPE, stdin=subprocess.PIPE, **kwargs)
+ p = sub_process.Popen(args, stdout=sub_process.PIPE, stdin=sub_process.PIPE, **kwargs)
return (p.stdout, p.stdin)
if __name__ == "__main__":