Failure encountered while execution of installCerts.py script
[sdnc/oam.git] / installation / sdnc / src / main / scripts / installCerts.py
index 8135f60..ae5d5b3 100644 (file)
@@ -28,11 +28,15 @@ import shutil
 import subprocess
 import logging
 
+
 log_file = '/opt/opendaylight/data/log/installCerts.log'
+with open(os.path.join('/opt/opendaylight/data/log', 'installCerts.log'), 'w') as fp:
+    pass
+
 log_format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
 logging.basicConfig(filename=log_file,level=logging.DEBUG,filemode='w',format=log_format)
 
-Path = os.environ['ODL_CERT_DIR']
+Path = "/tmp"
 
 zipFileList = []
 
@@ -217,19 +221,19 @@ def timeIncrement(timePassed):
 
 def get_pass(file_name):
     try:
-        with open(file_name , 'r') as file_obj:
+        with open(file_name, 'r') as file_obj:
             password = file_obj.read().strip()
-        return password
+        return "'{}'".format(password)
     except Exception as e:
         logging.error("Error occurred while fetching password : %s", e)
         exit()
 
 
 def cleanup():
-    for file in os.listdir(Path):
-        if os.path.isfile(Path + '/' + file):
-            logging.debug("Cleaning up the file %s", Path + '/'+ file)
-            os.remove(Path + '/'+ file)
+    for file in jks_files:
+        if os.path.isfile(file):
+            logging.debug("Cleaning up the file %s", file)
+            os.remove(file)
 
 
 def jks_to_p12(file, password):