Bug 1466225 - inconsistent response when deleting nonexistent VM snapshot using API
inconsistent response when deleting nonexistent VM snapshot using API
Status: CLOSED CURRENTRELEASE
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API (Show other bugs)
5.8.0
Unspecified Unspecified
medium Severity medium
: GA
: 5.9.0
Assigned To: Jillian Tullo
Martin Kourim
rest:snapshot
: TestOnly, ZStream
Depends On:
Blocks: 1478506
  Show dependency treegraph
 
Reported: 2017-06-29 05:43 EDT by Martin Kourim
Modified: 2018-03-06 10:31 EST (History)
4 users (show)

See Also:
Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1478506 (view as bug list)
Environment:
Last Closed: 2018-03-06 10:31:36 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Martin Kourim 2017-06-29 05:43:11 EDT
Description of problem:
When deleting nonexistent snapshot using REST API using POST, the response is
{
    "success": false,
    "message": "No snapshots available for this VM"
}
and the HTTP status is 200 (success)

When deleting nonexistent snapshot using using the DELETE HTTP method, the response is empty and and the HTTP status is 204 (success).

The responses are inconsistent with responses from other collections where the "ActiveRecord::RecordNotFound" error is returned and the HTTP status is 404 (not found).

E.g. deleting nonexistent VM:
{
    "error": {
        "kind": "not_found",
        "message": "Couldn't find Vm with 'id'=199999 ...",
        "klass": "ActiveRecord::RecordNotFound"
    }
}
HTTP status 404


Version-Release number of selected component (if applicable):
5.8.1.0


How reproducible:
Very


Steps to Reproduce:
1.
POST https://10.8.197.241/api/vms/<id_of_existing_vm>/snapshots/2222
{"action": "delete"}
or
DELETE https://10.8.197.241/api/vms/<id_of_existing_vm>/snapshots/2222


Expected results:
"ActiveRecord::RecordNotFound", HTTP status 404
Comment 2 Jillian Tullo 2017-06-30 14:55:22 EDT
PR: https://github.com/ManageIQ/manageiq/pull/15489
Comment 4 Martin Kourim 2017-10-24 05:10:14 EDT
Verified that deleting nonexistent snapshot using REST API results in ActiveRecord::RecordNotFound"

Note You need to log in before you can comment on or make changes to this bug.