Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-19502

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

XMLWordPrintable

    • Moderate
    • None

      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):

      How reproducible: Always. Same for 6.4, most likely even older Satellite.

      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.

            aruzicka@redhat.com Adam Ruzicka
            rhn-support-jjansky Jan Jansky
            Peter Ondrejka Peter Ondrejka
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: