Bug 1806702

Summary: [RFE] API: Support create/edit/delete for /api/policy_profiles
Product: Red Hat CloudForms Management Engine Reporter: Satoe Imaishi <simaishi>
Component: APIAssignee: drew uhlmann <duhlmann>
Status: CLOSED ERRATA QA Contact: Parthvi Vala <pvala>
Severity: medium Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: unspecified    
Version: 5.11.0CC: obarenbo, pvala, yrudman
Target Milestone: GAKeywords: ZStream
Target Release: 5.11.4Flags: pm-rhel: cfme-5.11.z+
simaishi: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.4.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1806701 Environment:
Last Closed: 2020-03-17 13:11:39 UTC Type: ---
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:
Bug Depends On: 1806701    
Bug Blocks:    

Comment 2 CFME Bot 2020-02-24 19:17:14 UTC
New commit detected on ManageIQ/manageiq-api/ivanchuk:

https://github.com/ManageIQ/manageiq-api/commit/c330a9c6b8bf41ab1ef1278a1154d717d244e317
commit c330a9c6b8bf41ab1ef1278a1154d717d244e317
Author:     Alberto Bellotti <abellotti.github.com>
AuthorDate: Mon Feb 24 18:03:15 2020 +0000
Commit:     Alberto Bellotti <abellotti.github.com>
CommitDate: Mon Feb 24 18:03:15 2020 +0000

    Merge pull request #749 from gtanzillo/enable-add-edit-policy-profiles

    Enable add and edit resource for /api/policy_profiles endpoint

    (cherry picked from commit 32ea08e8a31da847d5a3cf607733ed75b58bea6f)

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1806702

 app/controllers/api/policy_profiles_controller.rb | 12 +
 config/api.yml | 11 +-
 spec/requests/policies_spec.rb | 75 +
 3 files changed, 91 insertions(+), 7 deletions(-)

Comment 3 Parthvi Vala 2020-02-26 12:37:28 UTC
PARTIALLY FIXED. Tested on 5.11.4.0.20200224230733_ab25bbf.

Observations:
1. I was able to create a policy profile.
2. I was able to delete the policy profile.
3. I was not able to edit or delete a read only policy profile, which is expected.
4. I was able to edit the policy but **not** via collection.
This is the query I passed and the response received.
POST /api/policy_profiles
{
    "action": "edit",
    "resource": {
        "href": :pp_href
        "id": :pp_id,
        "name": "New name"
    }
}

Response:
{
  "error": {
    "kind": "not_found",
    "message": "Couldn't find MiqPolicySet without an ID",
    "klass": "ActiveRecord::RecordNotFound"
  }
}


Moving this BZ to ASSIGNED since it failed while editing a policy profile via Policy Profiles Collection.
Let me know if this seems wrong.

Comment 4 Parthvi Vala 2020-02-27 13:57:56 UTC
I was probably sending a bad request here because I worked with Drew and it seems to be working. Moving this to Verified.

Comment 7 errata-xmlrpc 2020-03-17 13:11:39 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-2020:0867