From e26f6120123c142fcbb949eaa69c1d20aa089f18 Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@kr.ethz.ch>
Date: Fri, 7 Oct 2011 09:29:22 +0200
Subject: [PATCH] move file_to_list to cdist

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
---
 lib/cdist/__init__.py | 14 ++++++++++++++
 lib/cdist/emulator.py |  4 ++--
 lib/cdist/path.py     | 21 ---------------------
 3 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/lib/cdist/__init__.py b/lib/cdist/__init__.py
index fcfa3693..3a1b94e3 100644
--- a/lib/cdist/__init__.py
+++ b/lib/cdist/__init__.py
@@ -34,3 +34,17 @@ class MissingEnvironmentVariableError(Error):
 
     def __str__(self):
         return 'Missing required environment variable: ' + str(self.name)
+
+def file_to_list(filename):
+    """Return list from \n seperated file"""
+    if os.path.isfile(filename):
+        file_fd = open(filename, "r")
+        lines = file_fd.readlines()
+        file_fd.close()
+
+        # Remove \n from all lines
+        lines = map(lambda s: s.strip(), lines)
+    else:
+        lines = []
+
+    return lines
diff --git a/lib/cdist/emulator.py b/lib/cdist/emulator.py
index 51b2ecc1..f3e9ac30 100644
--- a/lib/cdist/emulator.py
+++ b/lib/cdist/emulator.py
@@ -43,10 +43,10 @@ def run(argv):
 
     parser = argparse.ArgumentParser(add_help=False)
 
-    for parameter in cdist.path.file_to_list(os.path.join(param_dir, "optional")):
+    for parameter in cdist.file_to_list(os.path.join(param_dir, "optional")):
         argument = "--" + parameter
         parser.add_argument(argument, action='store', required=False)
-    for parameter in cdist.path.file_to_list(os.path.join(param_dir, "required")):
+    for parameter in cdist.file_to_list(os.path.join(param_dir, "required")):
         argument = "--" + parameter
         parser.add_argument(argument, action='store', required=True)
 
diff --git a/lib/cdist/path.py b/lib/cdist/path.py
index 4c36bfa5..50977afd 100644
--- a/lib/cdist/path.py
+++ b/lib/cdist/path.py
@@ -38,20 +38,6 @@ log = logging.getLogger(__name__)
 
 import cdist.exec
 
-def file_to_list(filename):
-    """Return list from \n seperated file"""
-    if os.path.isfile(filename):
-        file_fd = open(filename, "r")
-        lines = file_fd.readlines()
-        file_fd.close()
-
-        # Remove \n from all lines
-        lines = map(lambda s: s.strip(), lines)
-    else:
-        lines = []
-
-    return lines
-
 class Path:
     """Class that handles path related configurations"""
 
@@ -92,13 +78,6 @@ class Path:
         self.object_base_dir = os.path.join(self.out_dir, "object")
         self.bin_dir = os.path.join(self.out_dir, "bin")
 
-
-        # List of type explorers transferred
-        self.type_explorers_transferred = {}
-
-        # objects prepared
-        self.objects_prepared = []
-
         # Create directories
         self.__init_out_dirs()