Detail message of ProblemDetails does not be shown properly

Bug #2007819 reported by Masaki UENO
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tacker
Fix Released
Low
Unassigned

Bug Description

In the current Tacker implementation, message of `ProblemDetails.detail` has a wrong format in particular situation.

When users queries a non existent VnfLcmOpOccV2, Tacker-server replies the below message, which has a incorrect strings:

```
~$ curl -v "http://127.0.0.1:9890/vnflcm/v2/vnf_lcm_op_occs/00000000-0000-0000-0000-000000000000" -H "X-Auth-Token: ${TOKEN}" -H "Version: 2.0.0"
* Trying 127.0.0.1:9890...
* Connected to 127.0.0.1 (127.0.0.1) port 9890 (#0)
> GET /vnflcm/v2/vnf_lcm_op_occs/00000000-0000-0000-0000-000000000000 HTTP/1.1
> Host: 127.0.0.1:9890
> User-Agent: curl/7.81.0
> Accept: */*
> X-Auth-Token: ******
> Version: 2.0.0
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Length: 96
< Version: 2.0.0
< Accept-Ranges: none
< Content-Type: application/problem+json
< X-Openstack-Request-Id: req-cf9d9fb3-fc8e-4705-9933-0dde22f03d84
< Date: Mon, 20 Feb 2023 14:01:47 GMT
<
* Connection #0 to host 127.0.0.1 left intact
{"status": 404, "detail": "VnfLcmOpOcc <built-in function id> not found.", "title": "Not Found"}
```

`<built-in function id>` is expected to be `00000000-0000-0000-0000-000000000000`.

The above bug has been occurred due to passing wrong parameter to `VnfLcmOpOccNotFound` exception at [1]. I think the code should pass `lcmocc_id` argument of `get_lcmocc` method directly to the exception like this:

```
def get_lcmocc(context, lcmocc_id):
    lcmocc = objects.VnfLcmOpOccV2.get_by_id(context, lcmocc_id)
    if lcmocc is None:
        raise sol_ex.VnfLcmOpOccNotFound(lcmocc_id=lcmocc_id)
    return lcmocc

```

[1] https://opendev.org/openstack/tacker/src/branch/master/tacker/sol_refactored/common/lcm_op_occ_utils.py#L35

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tacker (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/tacker/+/874529

Changed in tacker:
status: New → In Progress
Yasufumi Ogawa (yasufum)
Changed in tacker:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tacker (master)

Reviewed: https://review.opendev.org/c/openstack/tacker/+/874529
Committed: https://opendev.org/openstack/tacker/commit/7f5c3906e87318b78ff3cd9feda611bd5119da76
Submitter: "Zuul (22348)"
Branch: master

commit 7f5c3906e87318b78ff3cd9feda611bd5119da76
Author: Ken Fujimoto <email address hidden>
Date: Tue Feb 21 04:59:01 2023 +0000

    Fix incorrect lcmocc_id specified in "get_lcmocc"

    This patch fixes incorrect lcmocc_id is specified in
    "get_lcmocc" function if the lcmocc_id does not exist
    in VnfLcmOpOccV2.

    Closes-Bug: #2007819
    Change-Id: Ic64f1916fd90888bee8bc504eb3c493f1f2d6341

Changed in tacker:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tacker 9.0.0.0rc1

This issue was fixed in the openstack/tacker 9.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.