Hello,

I noticed a few problems when importing trees that this patch attempts to fix. Below is a changelog:

fixed import for s390(x).

fixed import of variants 4Desktop and 4common.

feature: look for kickstarts in the following directory structure on import
  /var/lib/cobbler/kickstarts/
                -> ARCH/OS_VERSION
                -> OS_VERSION
                -> ARCH/default.ks
                -> default.ks

>From 4303ac9a9aed65c4e6683563c86e5900932b8499 Mon Sep 17 00:00:00 2001
From: Bill Peck <[EMAIL PROTECTED]>
Date: Mon, 13 Oct 2008 15:55:07 -0400
Subject: [PATCH] fixed import for s390(x).

fixed import of variants 4Desktop and 4common.

feature: look for kickstarts in the following directory structure on import
   /var/lib/cobbler/kickstarts/
                 -> ARCH/OS_VERSION
                 -> OS_VERSION
                 -> ARCH/default.ks
                 -> default.ks
---
 cobbler/action_import.py |   49 +++++++++++++++++++++++++++++++--------------
 1 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/cobbler/action_import.py b/cobbler/action_import.py
index babdafd..ce84e29 100644
--- a/cobbler/action_import.py
+++ b/cobbler/action_import.py
@@ -205,7 +205,10 @@ class Importer:
 
            if (self.kickstart_file == None):
                kdir = os.path.dirname(distro.kernel)   
-               base_dir = "/".join(kdir.split("/")[0:-2])
+               if distro.arch == 's390x':
+                   base_dir = "/".join(kdir.split("/")[0:-1])
+               else:
+                   base_dir = "/".join(kdir.split("/")[0:-2])
           
                for try_entry in TRY_LIST:
                    try_dir = os.path.join(base_dir, try_entry)
@@ -234,7 +237,10 @@ class Importer:
        # find the tree location
        dirname = os.path.dirname(distro.kernel)
        tokens = dirname.split("/")
-       tokens = tokens[:-2]
+       if distro.arch == 's390x':
+           tokens = tokens[:-1]
+       else:
+           tokens = tokens[:-2]
        base = "/".join(tokens)
        dest_link = os.path.join(self.settings.webdir, "links", distro.name)
 
@@ -295,25 +301,13 @@ class Importer:
        # find the profile kickstart and set the distro breed/os-version based 
on what
        # we can find out from the rpm filenames and then return the kickstart
        # path to use.
-
        if flavor == "fedora":
-
-           # this may actually fail because the libvirt/virtinst database
-           # is not always up to date.  We keep a simplified copy of this
-           # in codes.py.  If it fails we set it to something generic
-           # and don't worry about it.
            distro.set_breed("redhat")
            try:
                distro.set_os_version("fedora%s" % int(major))
            except:
                print "- warning: could not store os-version fedora%s" % 
int(major)
                distro.set_os_version("other")
-
-           if major >= 8:
-                return profile.set_kickstart("/etc/cobbler/sample_end.ks")
-           if major >= 6:
-                return profile.set_kickstart("/etc/cobbler/sample.ks") 
-
        if flavor == "redhat" or flavor == "centos":
            distro.set_breed("redhat")
            if major <= 2:
@@ -326,6 +320,31 @@ class Importer:
                     print "- warning: could not store os-version %s" % 
int(major)
                     distro.set_os_version("other")
 
+       kickbase = "/var/lib/cobbler/kickstarts"
+       # Look for ARCH/OS_VERSION kickstart first
+       #          OS_VERSION next
+       #          ARCH/default.ks next
+       #          default.ks finally.
+       kickstarts = ["%s/%s/%s" % (kickbase,distro.arch,distro.os_version), 
+                     "%s/%s" % (kickbase,distro.os_version),
+                     "%s/%s/default.ks" % (kickbase,distro.arch),
+                     "%s/default.ks" % kickbase]
+       for kickstart in kickstarts:
+           if os.path.exists(kickstart):
+               return profile.set_kickstart(kickstart)
+
+       if flavor == "fedora":
+           # this may actually fail because the libvirt/virtinst database
+           # is not always up to date.  We keep a simplified copy of this
+           # in codes.py.  If it fails we set it to something generic
+           # and don't worry about it.
+
+           if major >= 8:
+                return profile.set_kickstart("/etc/cobbler/sample_end.ks")
+           if major >= 6:
+                return profile.set_kickstart("/etc/cobbler/sample.ks") 
+
+       if flavor == "redhat" or flavor == "centos":
            if major >= 5:
                 return profile.set_kickstart("/etc/cobbler/sample.ks")
 
@@ -345,7 +364,7 @@ class Importer:
        # it may be slightly wrong, but it will be close enough
        # for RHEL5 we can get it exactly.
        
-       for x in [ "4AS", "4ES", "4WS" ]:
+       for x in [ "4AS", "4ES", "4WS", "4common", "4Desktop" ]:
           if rpm.find(x) != -1:
              return ("redhat", 4, 0)
        for x in [ "3AS", "3ES", "3WS" ]:
-- 
1.5.5.1

_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to