New file_to_str function
Also, added close() to file_to_list function.
Change-Id: If9aaef919347ff8afafbf643b14d58cb16e215bc
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_misc.py b/lib/gen_misc.py
index 02aee84..f66caff 100755
--- a/lib/gen_misc.py
+++ b/lib/gen_misc.py
@@ -303,10 +303,22 @@
if trim:
line = line.strip()
lines.append(line)
+ file.close()
return lines
+def file_to_str(*args, **kwargs):
+ r"""
+ Return the contents of a file as a string.
+
+ Description of arguments:
+ See file_to_list defined above for description of arguments.
+ """
+
+ return '\n'.join(file_to_list(*args, **kwargs))
+
+
def return_path_list():
r"""
This function will split the PATH environment variable into a PATH_LIST