Bug 1659899
| Summary: | Error related to `towhat` while creating Policies via API | ||
|---|---|---|---|
| Product: | Red Hat CloudForms Management Engine | Reporter: | Parthvi Vala <pvala> |
| Component: | API | Assignee: | kwalsh |
| Status: | CLOSED NOTABUG | QA Contact: | Parthvi Vala <pvala> |
| Severity: | high | Docs Contact: | Red Hat CloudForms Documentation <cloudforms-docs> |
| Priority: | high | ||
| Version: | 5.10.0 | CC: | dmetzger, jrafanie, obarenbo, pvala |
| Target Milestone: | GA | Keywords: | Regression |
| Target Release: | 5.10.z | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2019-01-04 06:40:30 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | CFME Core | Target Upstream Version: | |
| Embargoed: | |||
Keith, can you take a look at this one? First of all, you want to install miqversions so you can see that 5.9 is roughly upstream gaprindashvili and 5.10 is roughly hammer. https://github.com/chrisarcand/miqversions With that info, you can see that we added a validation change to miq_policy.rb 12:20:29 ~/Code/manageiq (master) (2.4.4) + git log upstream/gaprindashvili...upstream/hammer app/models/miq_policy.rb commit 28ab0177beb315a791af3d60a7ca5ae1cfc5c29a Author: Brandon Dunne <brandondunne> Date: Fri Sep 28 14:38:24 2018 -0400 Merge pull request #18032 from jvlcek/bz_1435780_tow_hat_validations Validate towhat policy field (cherry picked from commit 52704166f4dc48ccc2ced8c6bac0e8001e8d786f) https://bugzilla.redhat.com/show_bug.cgi?id=1435780 ... Here: https://github.com/ManageIQ/manageiq/pull/18032 Let me know if you need help recreating the problem. |
Description of problem: Sending an API request to create policy gives error - "Towhat is not included in the list", even though it is passed in the query. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. Send a create Policies request via API Request: POST /api/policies Query: { "action": "create", "resources": [{ "name": "test_policy_cNUnZ", "conditions_ids": ["3", "4"], "towhat": "ManageIQ::Providers::Redhat::InfraManager", "policy_contents": [{ "event_id": 2, "actions": [{ "opts": { "qualifier": "failure" }, "action_id": 1 }] }], "mode": "compliance", "description": "Test Policy cNUnZ" }, { "name": "test_policy_swyOR", "conditions_ids": ["3", "4"], "towhat": "ManageIQ::Providers::Redhat::InfraManager", "policy_contents": [{ "event_id": 2, "actions": [{ "opts": { "qualifier": "failure" }, "action_id": 1 }] }], "mode": "compliance", "description": "Test Policy swyOR" }, { "name": "test_policy_axyOP", "conditions_ids": ["3", "4"], "towhat": "ManageIQ::Providers::Redhat::InfraManager", "policy_contents": [{ "event_id": 2, "actions": [{ "opts": { "qualifier": "failure" }, "action_id": 1 }] }], "mode": "compliance", "description": "Test Policy axyOP" } ] } Actual results: Response: { "error": { "kind": "bad_request", "message": "Could not create the new policy - Validation failed: MiqPolicy: Towhat is not included in the list", "klass": "Api::BadRequestError" } } Expected results: Response: { "name": "policies", "count": 3, "subcount": 3, "pages": 1, "resources": [ { "href": "https://<ip_address>/api/policies/1" }, { "href": "https://<ip_address>/api/policies/2" }, { "href": "https://<ip_address>/api/policies/3" } ], "actions": [ ... ], "links": { "self": "https://<ip_address>/api/policies?offset=0", "first": "https://<ip_address>/api/policies?offset=0", "last": "https://<ip_address>/api/policies?offset=0" } } Additional info: Works well on 5.9.