Description of problem: When editing /api/policies/:id the action fails with { "error": { "kind": "bad_request", "message": "Resource conditions_ids, policy_contents needs be specified for creating a new policies", "klass": "Api::BadRequestError" } } The request succeeds when complete data is supplied. However, it's not expected behavior to insist on supplying all the data used for creating the resource just for changing e.g. the description. Version-Release number of selected component (if applicable): How reproducible: Very Steps to Reproduce: 1. create new policy, e.g. with POST /api/policies { "action": "create", "resources": [{ "name": "test policy foo", "description": "Desc foo", "mode": "control", "towhat": "ContainerImage", "conditions_ids": [ 18, 19 ], "policy_contents": [{ "event_id": 2, "actions": [ {"action_id": 1, "opts": { "qualifier": "failure" } } ] }] }] } 2. edit the resource POST /api/policies/:id { "action": "edit", "description": "New Desc Bar" }
Note also the error message is wrong since it is talking on creating a resource: "Resource conditions_ids, policy_contents needs be specified for creating a new policies"
New commit detected on ManageIQ/manageiq/fine: https://github.com/ManageIQ/manageiq/commit/b402b859f454656abb2dd2d61f1dbb392e6aedf1 commit b402b859f454656abb2dd2d61f1dbb392e6aedf1 Author: Alberto Bellotti <abellotti.github.com> AuthorDate: Wed Mar 29 10:19:20 2017 -0400 Commit: Satoe Imaishi <simaishi> CommitDate: Fri Mar 31 17:21:07 2017 -0400 Merge pull request #14518 from moolitayer/policy_edit Allow partial POST edits on miq policy REST (cherry picked from commit 6872ded18179536a845e2e3b26658d1f5a8eb7ad) https://bugzilla.redhat.com/show_bug.cgi?id=1435777 app/controllers/api/policies_controller.rb | 5 ++--- spec/requests/api/policies_spec.rb | 9 +++++++++ 2 files changed, 11 insertions(+), 3 deletions(-)
Verified that the error is not produced on 5.9.0.2