Bug 1754972

Summary: API should not declare HTTP DELETE verb on pxe_servers collection
Product: Red Hat CloudForms Management Engine Reporter: Parthvi Vala <pvala>
Component: APIAssignee: abellott
Status: CLOSED CURRENTRELEASE QA Contact: Parthvi Vala <pvala>
Severity: medium Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: medium    
Version: 5.11.0CC: dmetzger, mfeifer, obarenbo, yrudman
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.12.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1767786 (view as bug list) Environment:
Last Closed: 2020-10-26 16:25:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Inquiry
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1767786    

Description Parthvi Vala 2019-09-24 13:09:17 UTC
Description of problem:
API should not be declaring HTTP DELETE verb on collections. In this specific case, API was allowing DELETE on the pxe_servers collection which causes incorrect representation of actions when fetching pxe_servers.

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

How reproducible:
Always

Steps to Reproduce:
1. Get an appliance
2. Fetch pxe_servers via GET /api/pxe_servers

Actual results:
You will notice the following 2 entries in the collection actions:
 {'name': 'edit',
  'method': 'patch',
  'href': 'https://<ip_address>/api/pxe_servers'},
 {'name': 'delete',
  'method': 'delete',
  'href': 'https://10.8.199.37/api/pxe_servers'}

Expected results:
Only the "post" method should be exposed, 'patch' and 'delete' must not be present.

Additional info:
Reference BZ -https://bugzilla.redhat.com/show_bug.cgi?id=1392595

Comment 3 Parthvi Vala 2019-09-24 13:44:33 UTC
I think there is some misunderstanding here, this BZ is not a regression. `pxe_servers` was added as a REST collection in 5.11 and actions were only added to it from 5.11.0.13 as far as I can tell.
The reference BZ I provided is related to `blueprints` collection.

Comment 4 abellott 2019-09-27 14:41:41 UTC
Correct, the collection level actions should not be declaring PATCH and DELETE as those are resource centric. I will work on the PR for this.

Comment 5 abellott 2019-09-30 19:21:18 UTC
PR Merged: https://github.com/ManageIQ/manageiq-api/pull/678