Bug #27259
closedDeletion of hostgroup will not remove connection between hostgroup and OpenScap policies
Description
Description of problem: When is deleted hostgroup with associated OpenScap policies, policies are not cleaned properly which end with failing API and hammer calls
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create hostgroup x,y,z
2. Create scap content a,b,c
3. Create scap policy d,e,f
4. Edit policy d,e,f and attach hostgroups x,y,z
5. Delete hostgroups x,y,z
6. hammer policy info --name d
Actual results:
Couldn't find all Hostgroups with 'id': (1, 2, 3) (found 0 results, but was looking for 3).
Expected results:
Id: 1
Name: d
Created at: 2019-01-01 00:00:00 UTC
Period: weekly
Weekday: monday
Day of month:
Cron line:
SCAP content Id: 1
SCAP Content profile Id: 1
Tailoring file Id:
Tailoring file profile Id:
Locations:
Default Location
Organizations:
Default Organization
Hostgroups:
Additional info:
In Database records are staying.
select * from foreman_openscap_assets;
id | created_at | updated_at | assetable_type | assetable_id
----+----------------------------+----------------------------+----------------+--------------
1 | 2019-07-09 07:51:27.390499 | 2019-07-09 07:51:27.390499 | Hostgroup | 1
2 | 2019-07-09 07:51:27.470928 | 2019-07-09 07:51:27.470928 | Hostgroup | 2
3 | 2019-07-09 07:51:27.474601 | 2019-07-09 07:51:27.474601 | Hostgroup | 3
4 | 2019-07-09 07:51:38.68147 | 2019-07-09 07:51:38.68147 | Hostgroup | 1
5 | 2019-07-09 07:51:38.698747 | 2019-07-09 07:51:38.698747 | Hostgroup | 2
6 | 2019-07-09 07:51:38.702891 | 2019-07-09 07:51:38.702891 | Hostgroup | 3
select * from foreman_openscap_asset_policies;
asset_id | policy_id
----------+-----------
1 | 1
2 | 1
3 | 1
4 | 2
5 | 2
6 | 2
7 | 3
8 | 3
9 | 3
Those records should be properly cleaned during hostgroup deletion.
Updated by Pavel Moravec over 3 years ago
- Subject changed from Deletion of hostgroup will not remove connection between hostgroup and OpenScap policies to Deletion of hostgroup will not remove connection between hostgroup and OpenScap policies
Updated by Oleh Fedorenko over 1 year ago
- Status changed from New to Assigned
- Assignee set to Oleh Fedorenko
- Triaged changed from No to Yes
Updated by The Foreman Bot 12 months ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman_openscap/pull/568 added
Updated by Adam Ruzicka 11 months ago
- Fixed in Releases foreman_openscap-9.0.0 added
- Fixed in Releases deleted (
foreman_openscap 8.1.0)