using miscutil.read_templatefile(temp_filename) function in domino client 35/15335/1
authorUlas Kozat <ulas.kozat@gmail.com>
Thu, 9 Jun 2016 17:58:30 +0000 (10:58 -0700)
committerUlas Kozat <ulas.kozat@gmail.com>
Thu, 9 Jun 2016 17:58:30 +0000 (10:58 -0700)
Change-Id: I9862a2c50ac7ba24bfc5708eb7ba06ca2419f199
Signed-off-by: Ulas Kozat <ulas.kozat@gmail.com>
DominoClient.py
lib/util/miscutil.py

index 9cdcc39..8ce8ae7 100755 (executable)
@@ -118,11 +118,6 @@ class CLIHandler:
     CLIrespmsg.CLI_response = "Testing..."
     return CLIrespmsg
  
-def read_templatefile(temp_filename): 
-  f = open(temp_filename, 'r')
-  lines = f.read().splitlines()
-
-  return lines
 
 class DominoClientCLIService(threading.Thread):
   def __init__(self, dominoclient, communicationhandler, interactive):
@@ -315,7 +310,7 @@ class DominoClient:
     pub_msg.template_type = 'tosca-nfv-v1.0'
 
     try:
-      pub_msg.template = read_templatefile(toscafile)
+      pub_msg.template = miscutil.read_templatefile(toscafile)
     except IOError as e:
       logging.error('I/O error(%d): %s' , e.errno, e.strerror)
       return
index 4afa565..ea284af 100644 (file)
@@ -7,6 +7,6 @@
 def read_templatefile(temp_filename): 
   f = open(temp_filename, 'r')
   lines = f.read().splitlines()
-
+  f.close()
   return lines