Fix error message for nonexistent vnf package
In Victoria release, the error handling of non-existing VNF package was modified, please refer to [1]. On passing a non-existing vnf package uuid to "vnf package upload" command, the tacker server sends an HTTP response with "Content-Type" header as "application/problem+json" and the reason for a failure described in the JSON problem details object. This patch extracts the ETSI error message in method exception_handler_v10. Fixes the issue and now it will output below error message: $ openstack vnf package upload --path sample_vnf_pkg.zip dummy-id Can not find requested vnf package: dummy-id Note: This bug was earlier address in Ussuri release, please refer [2]. [1] https://review.opendev.org/c/openstack/tacker/+/747678/37/tacker/api/vnfpkgm/v1/controller.py [2] https://review.opendev.org/c/openstack/python-tackerclient/+/688886 Co-Authored-By: Wataru Juso w-juso@nec.com Closes-Bug: #1847726 Change-Id: I25e1bdc32e0b91bbe02b82f79918c02b98e5f110
This commit is contained in:
parent
76da3dbd9d
commit
e7a0c96920
|
@ -54,6 +54,7 @@ def exception_handler_v10(status_code, error_content):
|
|||
:param status_code: HTTP error status code
|
||||
:param error_content: deserialized body of error response
|
||||
"""
|
||||
etsi_error_content = error_content
|
||||
error_dict = None
|
||||
if isinstance(error_content, dict):
|
||||
error_dict = error_content.get('TackerError')
|
||||
|
@ -94,6 +95,12 @@ def exception_handler_v10(status_code, error_content):
|
|||
if message:
|
||||
raise exceptions.TackerClientException(status_code=status_code,
|
||||
message=message)
|
||||
# ETSI error response
|
||||
if isinstance(etsi_error_content, dict):
|
||||
if etsi_error_content.get('detail'):
|
||||
message = etsi_error_content.get('detail')
|
||||
raise exceptions.TackerClientException(status_code=status_code,
|
||||
message=message)
|
||||
|
||||
# If we end up here the exception was not a tacker error
|
||||
msg = "%s-%s" % (status_code, error_content)
|
||||
|
|
Loading…
Reference in New Issue