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

feat: Add is_rhel_ai to parser of os_release #4313

Merged
merged 2 commits into from
Dec 20, 2024
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
8 changes: 8 additions & 0 deletions insights/parsers/os_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,11 @@ def data(self):
Deprecated, it will be removed from 3.7.0
"""
return self

@property
def is_rhel_ai(self):
JoySnow marked this conversation as resolved.
Show resolved Hide resolved
"""
Returns:
bool: True when the system is from RHEL AI image.
"""
return self.get("VARIANT", None) == "RHEL AI" and self.get("VARIANT_ID", None) == "rhel_ai"
2 changes: 2 additions & 0 deletions insights/tests/parsers/test_os_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def test_rhel():
rls = OsRelease(context_wrap(REHL_OS_RELEASE))
assert rls.get("VARIANT_ID") is None
assert rls.get("VERSION") == "7.2 (Maipo)"
assert rls.is_rhel_ai is False


def test_rhevh():
Expand All @@ -115,6 +116,7 @@ def test_rhel_ai():
assert rls.get("VARIANT_ID") == "rhel_ai"
assert rls.get("VARIANT") == "RHEL AI"
assert rls.get("BUILD_ID") == "v1.1.3"
assert rls.is_rhel_ai is True


def test_empty():
Expand Down
Loading