diff options
author | yangyan <yangyanyj@chinamobile.com> | 2020-03-23 18:31:16 +0800 |
---|---|---|
committer | Yan Yang <yangyanyj@chinamobile.com> | 2020-03-24 09:28:55 +0000 |
commit | 4e6242781065f62c47882019a57789092650063b (patch) | |
tree | 01ec935b59fc637f8203ab1a3c9aafef9a8bf5e6 | |
parent | 0352a65cf29f1e1498d51b3f60982f185a14bda7 (diff) |
Fault tolerant handling of exceptions thrown by verifyvnfd
Change-Id: Ia5c40d7413bac8fec58a7a8253089257ecadf588
Issue-ID: VFC-1651
Signed-off-by: yangyan <yangyanyj@chinamobile.com>
-rw-r--r-- | lcm/lcm/pub/verifyvnfd/tests.py | 7 | ||||
-rw-r--r-- | 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 |