Description of problem: Host Group is not being assigned to Compliance Policy when created using API with Host_ids parameter. Version-Release number of selected component (if applicable): - Satellite 6.6.0 snap 17 How reproducible: Always Steps to Reproduce: 1. When hostgroup_ids and host_ids both are used to create compliance policy then only host_ids are getting assigned to compliance policy. $ curl -k -u "admin:changeme" -X POST -H "Content-Type: application/json; charset=UTF-8" https://hostname.example.com/api/v2/compliance/policies/ -d '{"policy":{"name":"cp5","scap_content_id":1,"scap_content_profile_id":1,"period":"custom","cron_line":"10 * * * *","deploy_by":"manual","hostgroup_ids":[1],"host_ids":[1]}}' Actual results: $ curl -k -u "admin:changeme" -X POST -H "Content-Type: application/json; charset=UTF-8" https://hostname.example.com/api/v2/compliance/policies/ -d '{"policy":{"name":"cp5","scap_content_id":1,"scap_content_profile_id":1,"period":"custom","cron_line":"10 * * * *","deploy_by":"manual","hostgroup_ids":[1],"host_ids":[1]}}' {"created_at":"2019-08-29 13:25:49 UTC","updated_at":"2019-08-29 13:25:49 UTC","id":5,"name":"cp5","period":"custom","weekday":null,"description":null,"scap_content_id":1,"scap_content_profile_id":1,"day_of_month":null,"cron_line":"10 * * * *","tailoring_file_id":null,"tailoring_file_profile_id":null,"deploy_by":"manual","organizations":[],"locations":[],"hosts":[{"id":1,"name":"hostname.example.com"}],"hostgroups":[]} Expected results: $ curl -k -u "admin:changeme" -X POST -H "Content-Type: application/json; charset=UTF-8" https://hostname.example.com/api/v2/compliance/policies/ -d '{"policy":{"name":"cp5","scap_content_id":1,"scap_content_profile_id":1,"period":"custom","cron_line":"10 * * * *","deploy_by":"manual","hostgroup_ids":[1],"host_ids":[1]}}' {"created_at":"2019-08-29 13:25:49 UTC","updated_at":"2019-08-29 13:25:49 UTC","id":5,"name":"cp5","period":"custom","weekday":null,"description":null,"scap_content_id":1,"scap_content_profile_id":1,"day_of_month":null,"cron_line":"10 * * * *","tailoring_file_id":null,"tailoring_file_profile_id":null,"deploy_by":"manual","organizations":[],"locations":[],"hosts":[{"id":1,"name":"hostname.example.com"}],"hostgroups":[{"id":1,"name":"test","title":"test"}]} Additional info:
Created redmine issue https://projects.theforeman.org/issues/27754 from this bug
Upstream bug assigned to oprazak
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/27754 has been resolved.
Verified Verified with: - Satellite 6.6.0 snap 19 - tfm-rubygem-foreman_openscap-1.0.6-1.el7sat.noarch Test steps: - Create Compliance policy using both hostgroup_ids and host_ids # curl -k -u "admin:changeme" -X POST -H "Content-Type: application/json; charset=UTF-8" https://hostname.example.com/api/v2/compliance/policies/ -d '{"policy":{"name":"cp5","scap_content_id":1,"scap_content_profile_id":1,"period":"custom","cron_line":"10 * * * *","deploy_by":"manual","hostgroup_ids":[1],"host_ids":[1],"location_ids":[2],"organization_ids":[1]}}' {"created_at":"2019-09-09 11:26:48 UTC","updated_at":"2019-09-09 11:26:48 UTC","id":5,"name":"cp5","period":"custom","weekday":null,"description":null,"scap_content_id":1,"scap_content_profile_id":1,"day_of_month":null,"cron_line":"10 * * * *","tailoring_file_id":null,"tailoring_file_profile_id":null,"deploy_by":"manual","organizations":[{"id":1,"name":"Default Organization","title":"Default Organization"}],"locations":[{"id":2,"name":"Default Location","title":"Default Location"}],"hosts":[{"id":1,"name":"hostname.example.com"}],"hostgroups":[{"id":1,"name":"hg1","title":"hg1"}]}
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-2019:3172