File 0001-1398-koan-incompatible-with-F21-virt-install.patch of Package cobbler.8146

From 31a5ad794415ef11b4bc36a64b3159fc2468a76d Mon Sep 17 00:00:00 2001
From: Stephen Herr <sherr@redhat.com>
Date: Mon, 2 Feb 2015 15:15:32 -0500
Subject: [PATCH] 1398 - koan incompatible with F21 virt-install

Conflicts:
	koan/virtinstall.py
---
 koan/virtinstall.py | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

Index: cobbler-2.6.6/koan/virtinstall.py
===================================================================
--- cobbler-2.6.6.orig/koan/virtinstall.py
+++ cobbler-2.6.6/koan/virtinstall.py
@@ -72,7 +72,17 @@ except:
         for variant in variants:
             supported_variants.add(variant.split()[0])
     except:
-        pass # No problem, we'll just use generic
+        try:
+            # maybe on newer os using osinfo-query?
+            rc, response = utils.subprocess_get_response(
+                    shlex.split('osinfo-query os'))
+            variants = response.split('\n')
+            for variant in variants:
+                supported_variants.add(variant.split()[0])
+        except:
+            # okay, probably on old os and we'll just use generic26
+            pass
+
 
 def _sanitize_disks(disks):
     ret = []
@@ -366,8 +376,16 @@ def build_commandline(uri,
 
             # make sure virt-install knows about our os_version,
             # otherwise default it to virtio26 or generic26
-            found = False
-            if os_version not in supported_variants:
+            # found = False
+            if os_version in supported_variants:
+                pass # os_version is correct
+            elif os_version + ".0" in supported_variants:
+                # osinfo based virt-install only knows about major.minor
+                # variants, not just major variants like it used to. Default
+                # to major.0 variant in that case. Lack of backwards
+                # compatibility in virt-install grumble grumble.
+                os_version = os_version + ".0"
+            else:
                 if "virtio26" in supported_variants:
                     os_version = "virtio26"
                 else: