File use_grub2_on_suse.diff of Package cobbler.8146

Index: cobbler-2.6.6/koan/app.py
===================================================================
--- cobbler-2.6.6.orig/koan/app.py
+++ cobbler-2.6.6/koan/app.py
@@ -991,7 +991,10 @@ class Koan:
             if os.path.exists("/etc/grub.conf"):
                return (0, "grub")
             else:
-               return (0, "lilo") 
+               return (0, "lilo")
+        (make, version) = utils.os_release()
+        if (make == "suse"):
+            return (0, "grub2")
         cmd = [ "/sbin/grubby", "--bootloader-probe" ]
         probe_process = sub_process.Popen(cmd, stdout=sub_process.PIPE)
         which_loader = probe_process.communicate()[0]
@@ -1023,6 +1026,10 @@ class Koan:
                 if not os.path.exists("/usr/sbin/update-grub"):
                     raise InfoException, "grub2 is not installed"
                 use_grub2 = True
+            elif (make == "suse"):
+                if not os.path.exists("/usr/sbin/grub2-install"):
+                    raise InfoException, "grub2 is not installed"
+                use_grub2 = True
             else:
                 if not os.path.exists("/sbin/grubby"):
                     raise InfoException, "grubby is not installed"
@@ -1148,10 +1155,13 @@ class Koan:
 
                 # Set paths for Ubuntu/Debian
                 # TODO: Add support for other distros when they ship grub2
-                if make in ['ubuntu', 'debian']:
+                if make in ['ubuntu', 'debian', 'suse']:
                     grub_file = "/etc/grub.d/42_koan"
                     grub_default_file = "/etc/default/grub"
-                    cmd = ["update-grub"]
+                    if make in ['suse']:
+                        cmd = ['/sbin/update-bootloader', '--refresh']
+                    else:
+                        cmd = ["update-grub"]
                     default_cmd = ['sed', '-i', 's/^GRUB_DEFAULT\=.*$/GRUB_DEFAULT="%s"/g' % name, grub_default_file]
 
                 # Create grub2 menuentry