Skip to content
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
3 changes: 3 additions & 0 deletions shared/applicability/rhcos4-rhel8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: "cpe:/o:redhat:rhcos4:8"
title: "Red Hat Enterprise Linux CoreOS 4 RHEL8 Based"
check_id: installed_OS_is_rhcos4_rhel8
37 changes: 36 additions & 1 deletion shared/checks/oval/installed_OS_is_rhcos4.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<criterion comment="CoreOS variant" test_ref="test_rhel_coreos_variant" />
<criterion comment="RHCOS version 4 is installed" test_ref="test_rhcos4" />
</criteria>
<criteria operator="AND">
<criterion comment="RHCOS is installed (ID='rhcos')" test_ref="test_rhcos" />
<criterion comment="RHEL_VERSION is 8" test_ref="test_rhcos4_rhel8_rhel_version" />
</criteria>
<criteria operator="AND">
<criterion comment="RHCOS is installed (ID='rhcos')" test_ref="test_rhcos" />
<criterion comment="RHEL_VERSION is 9" test_ref="test_rhcos4_rhel9_rhel_version" />
Expand Down Expand Up @@ -96,6 +100,37 @@
</ind:textfilecontent54_state>
</def-group>

<def-group>
<definition class="inventory" id="installed_OS_is_rhcos4_rhel8" version="1">
<metadata>
<title>Red Hat Enterprise Linux CoreOS RHEL8 Based</title>
<affected family="unix">
<platform>multi_platform_all</platform>
</affected>
<reference ref_id="cpe:/o:redhat:rhcos4:8" source="CPE" />
<description>The operating system installed on the system is
Red Hat Enterprise Linux CoreOS RHEL8 Based</description>
</metadata>
<criteria operator="AND" comment="Old format: ID=rhcos with RHEL_VERSION=8.x">
<criterion comment="ID is rhcos" test_ref="test_rhcos" />
<criterion comment="RHEL_VERSION is 8" test_ref="test_rhcos4_rhel8_rhel_version" />
</criteria>
</definition>

<ind:textfilecontent54_test check="all" comment="rhcoreos RHEL_VERSION is 8 (old format)" id="test_rhcos4_rhel8_rhel_version" version="1">
<ind:object object_ref="obj_rhcos4_rhel8_rhel_version" />
<ind:state state_ref="state_rhcos4_rhel8_rhel_version" />
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="obj_rhcos4_rhel8_rhel_version" version="1">
<ind:filepath>/etc/os-release</ind:filepath>
<ind:pattern operation="pattern match">^RHEL_VERSION=&quot;?(\d+\.?\d*)&quot;?$</ind:pattern>
<ind:instance datatype="int">1</ind:instance>
</ind:textfilecontent54_object>
<ind:textfilecontent54_state id="state_rhcos4_rhel8_rhel_version" version="1">
<ind:subexpression operation="pattern match">^8\.</ind:subexpression>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we need to capture the value if it is just an 8, but we can fix it in another PR

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically we don't need it, however think it is a good pattern to have an object and state.
We can understand better if a fail is because the line doesn't exist or has wrong value.

And actually, a future optimization would be to unify obj_rhcos4_rhel8_rhel_version and obj_rhcos4_rhel9_rhel_version, since they collect the same line on the same file.

</ind:textfilecontent54_state>
</def-group>

<def-group>
<definition class="inventory" id="installed_OS_is_rhcos4_rhel9" version="1">
<metadata>
Expand Down Expand Up @@ -139,7 +174,7 @@
</ind:textfilecontent54_test>
<ind:textfilecontent54_object id="obj_rhcos4_rhel9_rhel_version" version="1">
<ind:filepath>/etc/os-release</ind:filepath>
<ind:pattern operation="pattern match">^RHEL_VERSION=(\d+\.?\d*)$</ind:pattern>
<ind:pattern operation="pattern match">^RHEL_VERSION=&quot;?(\d+\.?\d*)&quot;?$</ind:pattern>
<ind:instance datatype="int">1</ind:instance>
</ind:textfilecontent54_object>
<ind:textfilecontent54_state id="state_rhcos4_rhel9_rhel_version" version="1">
Expand Down
Loading