Project

General

Profile

Actions

Bug #27259

closed

Deletion of hostgroup will not remove connection between hostgroup and OpenScap policies

Added by Ondřej Pražák over 5 years ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
-
Difficulty:
Triaged:
Yes
Found in Releases:

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.

Actions

Also available in: Atom PDF