This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1728157 - Deletion of hostgroup will not remove connection between hostgroup and OpenScap policies
Summary: Deletion of hostgroup will not remove connection between hostgroup and OpenSc...
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: SCAP Plugin
Version: 6.9.0
Hardware: x86_64
OS: All
medium
medium
Target Milestone: stream
Assignee: Adam Ruzicka
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-09 08:07 UTC by Jan Jansky
Modified: 2024-12-20 18:52 UTC (History)
12 users (show)

Fixed In Version: rubygem-foreman_openscap-8.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-06-05 21:34:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 27259 0 Normal Closed Deletion of hostgroup will not remove connection between hostgroup and OpenScap policies 2024-05-16 14:05:36 UTC
Red Hat Issue Tracker   SAT-19502 0 None Migrated None 2024-06-05 21:34:15 UTC
Red Hat Knowledge Base (Solution) 5064501 0 None None None 2020-06-30 09:34:47 UTC

Description Jan Jansky 2019-07-09 08:07:20 UTC
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.

Comment 4 Ondřej Pražák 2019-07-10 07:14:51 UTC
Created redmine issue https://projects.theforeman.org/issues/27259 from this bug

Comment 9 Mike McCune 2021-07-13 21:54:48 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. This message may be a repeat of a previous update and the bug is again being considered to be closed. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 10 Mike McCune 2021-08-10 21:34:00 UTC
Thank you for your interest in Red Hat Satellite. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this feel free to contact your Red Hat Account Team. Thank you.

Comment 11 Pavel Moravec 2021-10-15 13:12:44 UTC
Reopening it as I have a reproducer. Basic idea: assign a Hostgroup to more Policies and then delete the HG. Second (and third etc., I expect) associated Policy will have invalid reference to the deleted HG.

Particular steps:
0) Create two policies (I use names 'SCAP-policy-test' with id=1 and 'SCAP-policy-test2' with id=2 below)

1) Have reproducer script reproducer_for_HG_Policy.sh :

HGNAME="HostGroup_$((RANDOM%100))"
hmr="echo "

$hmr policy update --name 'SCAP-policy-test'
$hmr policy update --name 'SCAP-policy-test2'

$hmr hostgroup create --name $HGNAME
$hmr policy update --hostgroups $HGNAME --id 1
$hmr policy update --hostgroups $HGNAME --id 2
$hmr hostgroup delete --name $HGNAME
$hmr policy update --name 'SCAP-policy-test'
$hmr policy update --name 'SCAP-policy-test2'

$hmr policy update --id 1
$hmr policy update --id 2
$hmr hostgroup create --name ${HGNAME}_2
$hmr policy update --hostgroups ${HGNAME}_2 --id 1
$hmr policy update --hostgroups ${HGNAME}_2 --id 2
$hmr hostgroup delete --name ${HGNAME}_2
$hmr policy update --id 1
$hmr policy update --id 2

2) Execute it:
./reproducer_for_HG_Policy.sh | hammer shell

3) See the results:
hammer> policy update --name SCAP-policy-test
Policy updated
hammer> policy update --name SCAP-policy-test2
Policy updated
hammer> hostgroup create --name HostGroup_88
Hostgroup created.
hammer> policy update --hostgroups HostGroup_88 --id 1
Policy updated
hammer> policy update --hostgroups HostGroup_88 --id 2
Policy updated
hammer> hostgroup delete --name HostGroup_88
Hostgroup deleted.
hammer> policy update --name SCAP-policy-test
Policy updated
hammer> policy update --name SCAP-policy-test2
Could not update the policy:
  Couldn't find Hostgroup with 'id'=26
hammer> policy update --id 1
Policy updated
hammer> policy update --id 2
Policy updated
hammer> hostgroup create --name HostGroup_88_2
Hostgroup created.
hammer> policy update --hostgroups HostGroup_88_2 --id 1
Policy updated
hammer> policy update --hostgroups HostGroup_88_2 --id 2
Policy updated
hammer> hostgroup delete --name HostGroup_88_2
Hostgroup deleted.
hammer> policy update --id 1
Policy updated
hammer> policy update --id 2
Policy updated
hammer> 

Surprisingly, "policy update --id .." _does_ work well, byt "policy update --name .." does _not_ work . Don't ask me why :) I have no clue. But at least "policy update --id .." is a workaround (that keeps orphaned records in DB, such that e.g. "policy list" does not work).

Comment 12 Pavel Moravec 2021-10-15 13:32:14 UTC
Please note that the key technical problem is in orphaned records in foreman_openscap_assets table. BUT *any* HG deletion (even associated to one Policy) leaves an orphaned record in foreman_openscap_asset_policies table.

These foreman_openscap_asset_policies orphans are not an issue now, as far as I tried various steps. But still it isn't nice to leave orphaned records either where, due to several reasons, and we should ideally fix this as well.

Comment 14 Mike McCune 2022-01-28 22:30:40 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. This message may be a repeat of a previous update and the bug is again being considered to be closed. If you have any concerns about this, please contact your Red Hat Account team. Thank you.

Comment 15 Mike McCune 2022-03-18 19:44:22 UTC
Thank you for your interest in Red Hat Satellite. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this feel free to contact your Red Hat Account Team. Thank you.

Comment 17 Mike McCune 2022-07-08 17:15:31 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. This message may be a repeat of a previous update and the bug is again being considered to be closed. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 18 Brad Buckingham 2022-09-02 20:08:50 UTC
Thank you for your interest in Red Hat Satellite. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this feel free to contact your Red Hat Account Team. Thank you.

Comment 19 Adam Ruzicka 2023-08-11 10:52:24 UTC
Reopening, we might take a stab at this as part of refreshing openscap.

Comment 20 Brad Buckingham 2023-09-01 21:10:52 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. This message may be a repeat of a previous update and the bug is again being considered to be closed. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 21 Oleh Fedorenko 2023-09-04 15:42:05 UTC
Closing as duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1368760.

Should be fixed since Satellite 6.3.0 and I cannot reproduce this anymore, but if the bug still persists, please feel free to re-open.

*** This bug has been marked as a duplicate of bug 1368760 ***

Comment 22 Pavel Moravec 2023-11-20 11:14:28 UTC
(In reply to Oleh Fedorenko from comment #21)
> Closing as duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=1368760.
> 
> Should be fixed since Satellite 6.3.0 and I cannot reproduce this anymore,
> but if the bug still persists, please feel free to re-open.
> 
> *** This bug has been marked as a duplicate of bug 1368760 ***

This is not fixed, at all. Reproducer steps from https://bugzilla.redhat.com/show_bug.cgi?id=1728157#c11 still apply.

Just have any SCAP content (e.g. import /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml), create the two policies SCAP-policy-test and SCAP-policy-test2 and run the script:

hammer> policy update --name SCAP-policy-test2
Could not update the policy:
  Couldn't find Hostgroup with 'id'=1
hammer> policy update --id 1


and also:

hammer> policy list
Couldn't find Hostgroup with 'id'=2
hammer>

Comment 23 Bryan Kearney 2023-11-28 16:00:43 UTC
Upstream bug assigned to ofedoren

Comment 24 Bryan Kearney 2023-11-28 16:00:45 UTC
Upstream bug assigned to ofedoren

Comment 25 Brad Buckingham 2023-12-01 18:41:30 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. This message may be a repeat of a previous update and the bug is again being considered to be closed. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 27 Brad Buckingham 2024-01-09 19:55:06 UTC
Based upon feedback during auto-closure, leaving this bugzilla open a while longer for additional investigation; however, it may be closed in a future iteration.

Comment 28 Eric Helms 2024-06-05 21:34:17 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


Note You need to log in before you can comment on or make changes to this bug.