summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstark, steven <steven.stark@att.com>2020-04-27 08:56:01 -0700
committerDaniel Rose <dr695h@att.com>2020-05-12 15:54:47 +0000
commited2e0bff023e51952957d1e64c069b8e0b111f9d (patch)
treee090171ffc68346ac0ca566631a4f5547d8ce0c8
parent06881dfa82e40a62529dfb46a5066b5150ebd537 (diff)
[TEST] updating ovp listener for sha generation6.0.0-ONAPfrankfurt
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