Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed solution for RHEL8 and RHEL9 in system detection to avoid false positives #12334

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion shared/checks/oval/installed_OS_is_rhel8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
<criterion comment="Installed operating system is part of the unix family"
test_ref="test_rhel8_unix_family" />
<criteria operator="OR">
<criterion comment="RHEL 8 is installed" test_ref="test_rhel8" />
<criteria operator="AND" comment="RHEL 8 is installed">
<criterion comment="RHEL 8 is installed" test_ref="test_rhel8" />
<!-- This prevent false positive RHEL8 in OL8 because OL8 has redhat-release package present-->
<extend_definition comment="Installed OS is not OL8" definition_ref="installed_OS_is_ol8" negate="true"/>
</criteria>
<criteria operator="AND" comment="Red Hat Enterprise Virtualization Host is installed">
<criterion comment="Red Hat Virtualization Host (RHVH)" test_ref="test_rhvh4_version" />
<criterion comment="Red Hat Enterprise Virtualization Host is based on RHEL 8" test_ref="test_rhevh_rhel8_version" />
Expand Down
6 changes: 5 additions & 1 deletion shared/checks/oval/installed_OS_is_rhel9.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
<criterion comment="Installed operating system is part of the unix family"
test_ref="test_rhel9_unix_family" />
<criteria operator="OR">
<criterion comment="RHEL 9 is installed" test_ref="test_rhel9" />
<criteria operator="AND" comment="RHEL 9 is installed">
<criterion comment="RHEL 9 is installed" test_ref="test_rhel9" />
<!-- This prevent false positive RHEL9 in OL9 because OL9 has redhat-release package present -->
<extend_definition comment="Installed OS is not OL9" definition_ref="installed_OS_is_ol9" negate="true"/>
</criteria>
<criteria operator="AND" comment="Red Hat Enterprise Virtualization Host is installed">
<criterion comment="Red Hat Virtualization Host (RHVH)" test_ref="test_rhvh4_version" />
<criterion comment="Red Hat Enterprise Virtualization Host is based on RHEL 9" test_ref="test_rhevh_rhel9_version" />
Expand Down
3 changes: 2 additions & 1 deletion ssg/build_derivatives.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def add_element_to(oval_root, tag_name, component_element):
if xml_el is None:
xml_el = ElementTree.Element("{%s}%s" % (oval_namespace, tag_name))
oval_root.append(xml_el)
xml_el.append(component_element)
if xml_el.find("%s[@id='%s']" % (component_element.tag, component_element.get("id"))) is None:
xml_el.append(component_element)


def add_oval_components_to_oval_xml(oval_root, tag_name, component_dict):
Expand Down
Loading