summaryrefslogtreecommitdiffstats
path: root/cobbler
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2009-05-26 17:26:24 -0400
committerMichael DeHaan <mdehaan@redhat.com>2009-05-26 17:26:24 -0400
commit064e970616d43a8dd0f33cc1db67f0884c3ad88e (patch)
treee05a11612f6aac41c8fd412b526971c2d32ec5c2 /cobbler
parentfd07f4ff059937a4eabf13d708cfc4f1866dd8dd (diff)
downloadcobbler-064e970616d43a8dd0f33cc1db67f0884c3ad88e.tar.gz
cobbler-064e970616d43a8dd0f33cc1db67f0884c3ad88e.tar.xz
cobbler-064e970616d43a8dd0f33cc1db67f0884c3ad88e.zip
Pair PAE and non-PAE content better during imports.
Diffstat (limited to 'cobbler')
-rw-r--r--cobbler/action_import.py43
-rw-r--r--cobbler/config.py2
2 files changed, 32 insertions, 13 deletions
diff --git a/cobbler/action_import.py b/cobbler/action_import.py
index 9a9e95d9..54a88f9d 100644
--- a/cobbler/action_import.py
+++ b/cobbler/action_import.py
@@ -3,7 +3,7 @@ Enables the "cobbler import" command to seed cobbler
information with available distribution from rsync mirrors
and mounted DVDs.
-Copyright 2006-2008, Red Hat, Inc
+Copyright 2006-2009, Red Hat, Inc
Michael DeHaan <mdehaan@redhat.com>
This program is free software; you can redistribute it and/or modify
@@ -499,7 +499,7 @@ class Importer:
# ========================================================================
- def distro_adder(self,foo,dirname,fnames):
+ def distro_adder(self,distros_added,dirname,fnames):
"""
This is an os.path.walk routine that finds distributions in the directory
@@ -512,8 +512,14 @@ class Importer:
initrd = None
kernel = None
+ # make sure we don't mismatch PAE and non-PAE types
+ pae_initrd = None
+ pae_kernel = None
+
for x in fnames:
+ adtl = None
+
fullname = os.path.join(dirname,x)
if os.path.islink(fullname) and os.path.isdir(fullname):
if fullname.startswith(self.path):
@@ -521,20 +527,30 @@ class Importer:
print "- warning: avoiding symlink loop"
continue
print "- following symlink: %s" % fullname
- os.path.walk(fullname, self.distro_adder, foo)
+ os.path.walk(fullname, self.distro_adder, distros_added)
if ( x.startswith("initrd") or x.startswith("ramdisk.image.gz") ) and x != "initrd.size":
- initrd = os.path.join(dirname,x)
+ if x.find("PAE") == -1:
+ initrd = os.path.join(dirname,x)
+ else:
+ pae_initrd = os.path.join(dirname, x)
if ( x.startswith("vmlinu") or x.startswith("kernel.img") or x.startswith("linux") ) and x.find("initrd") == -1:
- kernel = os.path.join(dirname,x)
+ if x.find("PAE") == -1:
+ kernel = os.path.join(dirname,x)
+ else:
+ pae_kernel = os.path.join(dirname, x)
+
+ # if we've collected a matching kernel and initrd pair, turn the in and add them to the list
if initrd is not None and kernel is not None and dirname.find("isolinux") == -1:
adtl = self.add_entry(dirname,kernel,initrd)
- if adtl != None:
- foo.extend(adtl)
- # Not resetting these values causes problems importing debian media because there are remaining items in fnames
- initrd = None
- kernel = None
+ elif pae_initrd is not None and pae_kernel is not None and dirname.find("isolinux") == -1:
+ adtl = self.add_entry(dirname,pae_kernel,pae_initrd)
+ if adtl != None:
+ distros_added.extend(adtl)
+ initrd = None
+ kernel = None
+
# ========================================================================
@@ -546,7 +562,7 @@ class Importer:
if possible.
"""
- proposed_name = self.get_proposed_name(dirname)
+ proposed_name = self.get_proposed_name(dirname,kernel)
proposed_arch = self.get_proposed_arch(dirname)
if self.arch and proposed_arch and self.arch != proposed_arch:
raise CX(_("Arch from pathname (%s) does not match with supplied one %s")%(proposed_arch,self.arch))
@@ -671,7 +687,7 @@ class Importer:
# ========================================================================
- def get_proposed_name(self,dirname):
+ def get_proposed_name(self,dirname,kernel=None):
"""
Given a directory name where we have a kernel/initrd pair, try to autoname
@@ -684,6 +700,9 @@ class Importer:
# remove the part that says /var/www/cobbler/ks_mirror/name
name = "-".join(dirname.split("/")[5:])
+ if kernel is not None and kernel.find("PAE") != -1:
+ name = name + "-PAE"
+
# These are all Ubuntu's doing, the netboot images are buried pretty
# deep. ;-) -JC
name = name.replace("-netboot","")
diff --git a/cobbler/config.py b/cobbler/config.py
index 11ef899d..5ec211a9 100644
--- a/cobbler/config.py
+++ b/cobbler/config.py
@@ -191,7 +191,7 @@ class Config:
"""
serializer.serialize(self._distros)
serializer.serialize(self._repos)
- serializer.serialize(self._profile)
+ serializer.serialize(self._profiles)
serializer.serialize(self._images)
serializer.serialize(self._systems)
serializer.serialize(self._networks)