Bug 1540894

Summary: API: edit action is repeated in response of GET custom button
Product: Red Hat CloudForms Management Engine Reporter: Anurag <ansinha>
Component: APIAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED ERRATA QA Contact: Parthvi Vala <pvala>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.9.0CC: akarol, cpelland, mkourim, obarenbo, pvala, simaishi
Target Milestone: GA   
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: :ui:custom_button
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-02-07 23:01:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: Bug
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:

Comment 3 CFME Bot 2018-02-13 13:15:39 UTC
New commit detected on ManageIQ/manageiq-api/master:
https://github.com/ManageIQ/manageiq-api/commit/c622ed7d720b0e34e626195e750231bbd04043fe

commit c622ed7d720b0e34e626195e750231bbd04043fe
Author:     Jillian Tullo <jtullo>
AuthorDate: Mon Feb 12 16:23:39 2018 -0500
Commit:     Jillian Tullo <jtullo>
CommitDate: Mon Feb 12 16:23:39 2018 -0500

    Do not return duplicate "edit" action entries
    
    In the api.yml, some collections define the put and patch methods, while others do not although they are allowed by default due to the verb specification. In the case where the put and/or patch methods are defined, the edit actions were being duplicated. This ensures they are only present once each.
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1540894

 app/controllers/api/base_controller/renderer.rb |  2 +-
 spec/requests/custom_buttons_spec.rb            | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

Comment 5 Parthvi Vala 2018-10-31 08:16:12 UTC
FIXED. Verified on 5.10.0.21.20181023151612_4c11b0d.

Request: POST https://<ip_address>/api/custom_buttons/1
Response: {
	"href": "https://<ip_address>/api/custom_buttons/1",
	"id": "1",
	"guid": "e39f18aa-bc08-4e7c-a6f0-19935d6c468d",
	"description": "Button",
	"applies_to_class": "User",
	"visibility_expression": null,
	"options": {
		"button_icon": "ff ff-region",
		"button_type": "default",
		"display": true,
		"open_url": false,
		"display_for": "single",
		"submit_how": "one"
	},
	"userid": "admin",
	"wait_for_complete": null,
	"created_on": "2018-10-31T08:09:04Z",
	"updated_on": "2018-10-31T08:09:04Z",
	"name": "custom_button",
	"visibility": {
		"roles": [
			"_ALL_"
		]
	},
	"applies_to_id": null,
	"enablement_expression": null,
	"disabled_text": null,
	"actions": [
		{
			"name": "edit",
			"method": "post",
			"href": "https://<ip_address>/api/custom_buttons/1"
		},
		{
			"name": "edit",
			"method": "patch",
			"href": "https://<ip_address>/api/custom_buttons/1"
		},
		{
			"name": "edit",
			"method": "put",
			"href": "https://<ip_address>/api/custom_buttons/1"
		},
		{
			"name": "delete",
			"method": "post",
			"href": "https://<ip_address>/api/custom_buttons/1"
		},
		{
			"name": "delete",
			"method": "delete",
			"href": "https://<ip_address>/api/custom_buttons/1"
		}
	]
}

Comment 6 errata-xmlrpc 2019-02-07 23:01:05 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/RHSA-2019:0212