Bug 1290783

Summary: Response [204] when you delete non-existent tag from tags collection
Product: Red Hat CloudForms Management Engine Reporter: Taras Lehinevych <tlehinev>
Component: APIAssignee: Tim Wade <twade>
Status: CLOSED ERRATA QA Contact: Taras Lehinevych <tlehinev>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 5.5.0CC: dajohnso, jhardy, obarenbo, tlehinev
Target Milestone: GA   
Target Release: 5.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: rest:tag
Fixed In Version: 5.6.0.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-29 15:19:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Taras Lehinevych 2015-12-11 12:59:38 UTC
Description of problem:
When you perform delete action twice for the same tag, you get the incorrect second response 204, should be 404
The same case when you perform the delete method via post request for non existent tag.

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

How reproducible:
Always

Steps to Reproduce:
First case:
1. Call delete method for any tag from tags collection a few times
 https://ip_address/api/tags/<tag_id> {'action': u'delete'}
2. Check the responses

Second case:
1. Call post method for tags collection
https://ip_address/api/tags 
{'action': u'delete', 'resources': [{'href': 'https://ip_address/api/tags/<tag_id>'}]} 
<tag_id> choose non existent id, for example 20000
2. Check the response

Actual results:
You get 204 response code and it doesn't matter how many time you are going to perform delete method for the same tag

Expected results:
First case:
You should get 404 response code at second attempt to delete tag, that server has not found anything matching the URI given, because the tag with <tag_id> specified in the request should be deleted.

Second case: 
You should get 404 response code, that server has not found anything matching the URI given, because tag with such id doesn't exist.

Additional info:
Other collections have the behavior described in Expected Result.

Comment 2 Tim Wade 2016-01-05 18:08:48 UTC
PR: https://github.com/ManageIQ/manageiq/pull/6041

Comment 3 Taras Lehinevych 2016-04-20 16:10:34 UTC
Verified in 5.6.0.1-beta2

Comment 5 errata-xmlrpc 2016-06-29 15:19:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1348