[VVP] Make Preload Generation more reslient to failures 96/97696/1
authorLovett, Trevor <trevor.lovett@att.com>
Tue, 29 Oct 2019 16:33:26 +0000 (11:33 -0500)
committerLovett, Trevor (tl2972) <tl2972@att.com>
Tue, 29 Oct 2019 16:42:43 +0000 (11:42 -0500)
Ensure that errors during preload do not prevent validation
report creation

Issue-ID: VVP-335
Signed-off-by: Lovett, Trevor <trevor.lovett@att.com>
Change-Id: I0cfd411b6a034422e349b96c462e68a4f0ceb876

ice_validator/preload/model.py
ice_validator/tests/conftest.py

index db60438..3ca7bda 100644 (file)
@@ -251,7 +251,8 @@ def env_path(heat_path):
     :return: path to env file (assumes it is present and named correctly)
     """
     base_path = os.path.splitext(heat_path)[0]
-    return "{}.env".format(base_path)
+    env_path = "{}.env".format(base_path)
+    return env_path if os.path.exists(env_path) else None
 
 
 class VnfModule(FilterBaseOutputs):
index 3ef7fe1..9a839b5 100644 (file)
@@ -348,7 +348,11 @@ def pytest_sessionfinish(session, exitstatus):
 def pytest_terminal_summary(terminalreporter, exitstatus):
     # Ensures all preload information and warnings appear after
     # test results
-    create_preloads(terminalreporter.config, exitstatus)
+    try:
+        create_preloads(terminalreporter.config, exitstatus)
+    except Exception:
+        print("Error creating preloads, skipping preload generation")
+        traceback.print_exc()
 
 
 # noinspection PyUnusedLocal