From 515c22944d93695623e78cb610ce55728329218d Mon Sep 17 00:00:00 2001 From: albailey Date: Mon, 8 Nov 2021 15:50:21 -0600 Subject: [PATCH] Propagate unexpected errors from nfv client The code that was iterating over unexpected errors would accidentally 'return' rather than raise the error during the area where it extracts a reason from the exception. This meant that if the API returned an internal error (500) the code would mistakenly treat the result as a None response. This was particularly troublesome when performing GET operations. Now it reports the error and allows the exception to be raised. Test Plan: PASS: Verify the CLI reports an error when invoked while the API is beng restarted. PASS: Verify the CLI returns a valid value when invoked under normal circumstances. PASS: Verify the API reports an error rather than None when a strategy is queried during an API restart. Closes-Bug: 1950207 Signed-off-by: albailey Change-Id: I7dc62b28425f09edabf2e6e4914aebc013da3cf4 --- nfv/nfv-client/nfv_client/openstack/rest_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nfv/nfv-client/nfv_client/openstack/rest_api.py b/nfv/nfv-client/nfv_client/openstack/rest_api.py index ab55c142..23544ce7 100755 --- a/nfv/nfv-client/nfv_client/openstack/rest_api.py +++ b/nfv/nfv-client/nfv_client/openstack/rest_api.py @@ -91,7 +91,7 @@ def request(token_id, method, api_cmd, api_cmd_headers=None, if message is not None: reason = str(message.rstrip('.')) print("Operation failed: %s" % reason) - return + break except ValueError: pass