From 2e50092b2437913561a37c646e622630d3dd9d12 Mon Sep 17 00:00:00 2001
From: Nikos Skalkotos <skalkoto@grnet.gr>
Date: Wed, 20 Jun 2012 15:17:01 +0300
Subject: [PATCH] Make os_type list_sysprep method return 1 list

The method used to return 2 lists of enabled and disabled sysprep
object. Since sysprep objs contail an `enabled' attribute, it is easy
to determine which of those are enabled and which are not. There is
no need to return 2 seperate lists.
---
 image_creator/os_type/__init__.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/image_creator/os_type/__init__.py b/image_creator/os_type/__init__.py
index 6fe1336..e1481d1 100644
--- a/image_creator/os_type/__init__.py
+++ b/image_creator/os_type/__init__.py
@@ -90,10 +90,7 @@ class OSBase(object):
         objs = [getattr(self, name) for name in dir(self) \
             if not name.startswith('_')]
 
-        enabled = [x for x in objs if self._is_sysprep(x) and x.enabled]
-        disabled = [x for x in objs if self._is_sysprep(x) and not x.enabled]
-
-        return enabled, disabled
+        return [x for x in objs if self._is_sysprep(x)]
 
     def _sysprep_change_status(self, name, status):
 
@@ -123,7 +120,9 @@ class OSBase(object):
     def print_syspreps(self):
         """Print enabled and disabled system preperation operations."""
 
-        enabled, disabled = self.list_syspreps()
+        syspreps = self.list_syspreps()
+        enabled = filter(lambda x: x.enabled, syspreps)
+        disabled = filter(lambda x: not x.enabled, syspreps)
 
         wrapper = textwrap.TextWrapper()
         wrapper.subsequent_indent = '\t'
-- 
GitLab