summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstark, steven <steven.stark@att.com>2020-05-26 08:39:02 -0700
committerstark, steven <steven.stark@att.com>2020-05-26 08:39:02 -0700
commitd26b1982333e28bd4def87ccc9fa877a642dc82a (patch)
treee5b216ea10a2d2004da5c8835bbe0193d711a8bf
parent2211166d744e6a7dd610baae0cfcfd497e7c29bc (diff)
[TEST] updating ovp listener for sha generationelalto
cherry-pick from master Issue-ID: TEST-233 Signed-off-by: stark, steven <steven.stark@att.com> Change-Id: If8af6eae4763e35cc7745bc6e70a12b287ef1917
-rw-r--r--robotframework-onap/listeners/OVPListener.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/robotframework-onap/listeners/OVPListener.py b/robotframework-onap/listeners/OVPListener.py
index 508568b..69fd3ba 100644
--- a/robotframework-onap/listeners/OVPListener.py
+++ b/robotframework-onap/listeners/OVPListener.py
@@ -22,7 +22,7 @@ from zipfile import ZipFile
OUTPUT_DATA = {
"vnf_checksum": "",
"build_tag": "",
- "version": "2019.09",
+ "version": "2019.12",
"test_date": "",
"duration": "",
"vnf_type": "heat",
@@ -107,19 +107,18 @@ class OVPListener:
def sha256(template_directory):
heat_sha = None
+ zip_file = "{}/tmp.zip".format(template_directory)
+ onlyfiles = [f for f in os.listdir(template_directory) if os.path.isfile(os.path.join(template_directory, f))]
- if os.path.exists(template_directory):
- zip_file = "{}/tmp_heat.zip".format(template_directory)
- with ZipFile(zip_file, "w") as zip_obj:
- for folder_name, subfolders, filenames in os.walk(template_directory):
- for filename in filenames:
- file_path = os.path.join(folder_name, filename)
- zip_obj.write(file_path)
+ with ZipFile(zip_file, 'w') as zipObj:
+ for filename in onlyfiles:
+ zipObj.write(os.path.join(template_directory, filename), arcname=filename)
- with open(zip_file, "rb") as f:
- bytes = f.read()
- heat_sha = hashlib.sha256(bytes).hexdigest()
+ with open(zip_file, "rb") as f:
+ bytes = f.read()
+ heat_sha = hashlib.sha256(bytes).hexdigest()
+ if os.path.exists(zip_file):
os.remove(zip_file)
return heat_sha