From 4e6242781065f62c47882019a57789092650063b Mon Sep 17 00:00:00 2001 From: yangyan Date: Mon, 23 Mar 2020 18:31:16 +0800 Subject: Fault tolerant handling of exceptions thrown by verifyvnfd Change-Id: Ia5c40d7413bac8fec58a7a8253089257ecadf588 Issue-ID: VFC-1651 Signed-off-by: yangyan --- lcm/lcm/pub/verifyvnfd/tests.py | 7 ++----- lcm/lcm/pub/verifyvnfd/verifyvnfd.py | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lcm/lcm/pub/verifyvnfd/tests.py b/lcm/lcm/pub/verifyvnfd/tests.py index bc0e974b..29ce718f 100644 --- a/lcm/lcm/pub/verifyvnfd/tests.py +++ b/lcm/lcm/pub/verifyvnfd/tests.py @@ -15,7 +15,6 @@ import unittest from lcm.pub.verifyvnfd import verifyvnfd from . import const -from lcm.pub.exceptions import NFLCMException class VerifyVnfdTest(unittest.TestCase): @@ -38,7 +37,5 @@ class VerifyVnfdTest(unittest.TestCase): self.assertEqual(ret, True) def test_vnfd_verfify_fail_for_missing_required(self): - try: - verifyvnfd.verify(const.vnfd_model_miss_required) - except NFLCMException as e: - self.assertNotEqual(e.args[0], "") + ret = verifyvnfd.verify(const.vnfd_model_miss_required) + self.assertNotEqual(ret, "") diff --git a/lcm/lcm/pub/verifyvnfd/verifyvnfd.py b/lcm/lcm/pub/verifyvnfd/verifyvnfd.py index 0276c097..abcd9593 100644 --- a/lcm/lcm/pub/verifyvnfd/verifyvnfd.py +++ b/lcm/lcm/pub/verifyvnfd/verifyvnfd.py @@ -18,7 +18,6 @@ import os import six import logging import jsonschema -from lcm.pub.exceptions import NFLCMException logger = logging.getLogger(__name__) @@ -57,5 +56,6 @@ def verify(new_vnfd): logger.error("vnfd verify fail,%s" % _format_validation_error(error)) errors_found.append(_format_validation_error(error)) if len(errors_found) > 0: - raise NFLCMException(errors_found) + logger.error(errors_found) + return errors_found return True -- cgit 1.2.3-korg