Bug 1524329
Summary: | API endpoint for auto_attach subscription in host bulk action is incorrect | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Ranjan Kumar <rankumar> |
Component: | Subscription Management | Assignee: | Ranjan Kumar <rankumar> |
Status: | CLOSED ERRATA | QA Contact: | Lukáš Hellebrandt <lhellebr> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 6.2.12 | CC: | akarsale, andrew.schofield, bbuckingham, lhellebr, mhulan, tstrachota |
Target Milestone: | 6.4.0 | Keywords: | Triaged |
Target Release: | Unused | ||
Hardware: | x86_64 | ||
OS: | All | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2018-10-16 19:35:13 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Ranjan Kumar
2017-12-11 09:35:45 UTC
Moving from POST to ASSIGNED. Once it is merged upstream, it can go to POST. Thanks for the submission!! I think this might not be a subscription-manager bug. Apologies if that is not so, also removed the Triaged keyword so my action can be verified. If it is a subscription manager bug please elaborate a little. Apologies. I misread the component name. undoing all my changes. Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21923 has been resolved. Verified with Sat 6.4 snap 18. API Help now contains the correct path. # curl -u admin:changeme --request PUT --url https://$(hostname)/api/hosts/bulk/auto_attach --header 'content-type: application/json' --data '{"organization_id": 1, "included": {"ids": [35,20]}}' {"id":"a626d652-0ba2-4504-a5a3-3562c0b5c483","label":"Actions::BulkAction","pending":true,"action":"Bulk action","username":"admin","started_at":"2018-08-31 12:41:11 UTC","ended_at":null,"state":"planned","result":"pending","progress":0.0,"input":{"action_class":"Actions::Katello::Host::AutoAttachSubscriptions","target_ids":[20,35],"target_class":"Host::Managed","args":[],"current_user_id":4},"output":{},"humanized":{"action":"Bulk action","input":null,"output":null,"errors":[]},"cli_example":null} => The task has been added, verified in WUI. When using the old path with .../subscriptions/... , a potentially misleading error occurs: {"displayMessage":"Action unauthorized to be performed on selected hosts.","errors":["Action unauthorized to bsubscriptions/auto_attach --header 'content-type: application/json' --data '{"organization_id": 1, "included": {"ids": [420,421]}}'(hostname)/api/hosts/bulk/auto_attach --header 'content-type: application/json' --data '{"org {"displayMessage":"Couldn't find Host::Managed with 'id'=bulk [WHERE \"hosts\".\"type\" IN ('Host::Managed') AND \"hosts\".\"organization_id\" = 1]","errors":["Couldn't find Host::Managed with 'id'=bulk [WHERE \"hosts\".\"type\" IN ('Host::Managed') AND \"hosts\".\"organization_id\" = 1]"]} That is because the non-bulk version of the API call matches the path and "bulk" is treated as ID. This can potentially cause trouble but I think it makes sense as it is. 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-2018:2927 |