From 51ef343e6066d644ceea21bdac29e95abaf54ae1 Mon Sep 17 00:00:00 2001
From: Nandor Sivok <nandor@gawker.com>
Date: Wed, 9 Oct 2013 12:22:12 +0200
Subject: [PATCH] cobbler inventory list systems without mgmt_classes as
 ungrouped

---
 plugins/inventory/cobbler.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/plugins/inventory/cobbler.py b/plugins/inventory/cobbler.py
index 223f8e37be4..e7a96ce84a0 100755
--- a/plugins/inventory/cobbler.py
+++ b/plugins/inventory/cobbler.py
@@ -96,6 +96,10 @@ if len(sys.argv) == 2 and (sys.argv[1] == '--list'):
             # first DNS name but no further DNS names
             groups[cls].append(dns_name)
 
+        # handle hosts without mgmt_classes
+        if not classes:
+            groups['ungrouped'].append(dns_name)
+
     print json.dumps(groups)
     sys.exit(0)