Description of problem: API call for subscription auto attach fails for bulk actions → curl -u admin:<password> --request PUT --url https://satellite.example.com/api/hosts/bulk/subscriptions/auto_attach --header 'content-type: application/json' --data '{"organization_id": 1, "included": {"ids": [<host_id-1>,<host_id-2>]}}' {"displayMessage":"ActiveRecord::RecordNotFound","errors":["ActiveRecord::RecordNotFound"]} Version-Release number of selected component (if applicable): 6.2.12 How reproducible: Always
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