File fix-setting-system-to-image.dif of Package cobbler

From cb005bcb45022ef0d486ab1267b771a2f1819037 Mon Sep 17 00:00:00 2001
From: James Cammarata <jimi@sngx.net>
Date: Fri, 5 Apr 2013 16:34:56 -0500
Subject: [PATCH] BUGFIX - Issue #425 - setting system to memtest image fails

---
 cobbler/pxegen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: cobbler-2.2.2/cobbler/pxegen.py
===================================================================
--- cobbler-2.2.2.orig/cobbler/pxegen.py
+++ cobbler-2.2.2/cobbler/pxegen.py
@@ -535,7 +535,7 @@ class PXEGen:
                         template = os.path.join(self.settings.pxe_template_dir,"pxesystem_ia64.template")
                     elif arch.startswith("ppc"):
                         template = os.path.join(self.settings.pxe_template_dir,"pxesystem_ppc.template")
-                    elif distro.os_version.startswith("esxi"):
+                    elif distro and distro.os_version.startswith("esxi"):
                         # ESXi uses a very different pxe method, using more files than
                         # a standard kickstart and different options - so giving it a dedicated
                         # PXE template makes more sense than shoe-horning it into the existing
@@ -591,7 +591,7 @@ class PXEGen:
                 image, arch, kickstart_path)
         metadata["kernel_options"] = kernel_options
 
-        if distro.os_version.startswith("esxi") and filename is not None:
+        if distro and distro.os_version.startswith("esxi") and filename is not None:
             append_line = "BOOTIF=%s" % (os.path.basename(filename))
         elif metadata.has_key("initrd_path") and (not arch or arch not in ["ia64", "ppc", "ppc64"]):
             append_line = "append initrd=%s" % (metadata["initrd_path"])
openSUSE Build Service is sponsored by