Bug 1466225 - inconsistent response when deleting nonexistent VM snapshot using API
Summary: inconsistent response when deleting nonexistent VM snapshot using API
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.8.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: 5.9.0
Assignee: Jillian Tullo
QA Contact: Martin Kourim
URL:
Whiteboard: rest:snapshot
Depends On:
Blocks: 1478506
TreeView+ depends on / blocked
 
Reported: 2017-06-29 09:43 UTC by Martin Kourim
Modified: 2018-03-06 15:31 UTC (History)
4 users (show)

Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1478506 (view as bug list)
Environment:
Last Closed: 2018-03-06 15:31:36 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Martin Kourim 2017-06-29 09:43:11 UTC
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 18:55:22 UTC
PR: https://github.com/ManageIQ/manageiq/pull/15489

Comment 4 Martin Kourim 2017-10-24 09:10:14 UTC
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.