From abf906ad1cbca6986e2758cd719cb8e3fdcff6e2 Mon Sep 17 00:00:00 2001 From: Noah Ablaseau Date: Wed, 22 Nov 2023 11:31:41 -0500 Subject: [PATCH] Add Virtuozzo Linux as os_family=Redhat --- salt/grains/core.py | 2 ++ tests/pytests/unit/grains/test_core.py | 30 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/salt/grains/core.py b/salt/grains/core.py index 4667f626e16..ddd479fce32 100644 --- a/salt/grains/core.py +++ b/salt/grains/core.py @@ -1701,6 +1701,7 @@ _OS_NAME_MAP = { "oracleserv": "OEL", "cloudserve": "CloudLinux", "cloudlinux": "CloudLinux", + "virtuozzo": "Virtuozzo", "almalinux": "AlmaLinux", "pidora": "Fedora", "scientific": "ScientificLinux", @@ -1771,6 +1772,7 @@ _OS_FAMILY_MAP = { "Scientific": "RedHat", "Amazon": "RedHat", "CloudLinux": "RedHat", + "Virtuozzo": "RedHat", "AlmaLinux": "RedHat", "OVS": "RedHat", "OEL": "RedHat", diff --git a/tests/pytests/unit/grains/test_core.py b/tests/pytests/unit/grains/test_core.py index a889fbb2285..92425fd21d1 100644 --- a/tests/pytests/unit/grains/test_core.py +++ b/tests/pytests/unit/grains/test_core.py @@ -1154,6 +1154,36 @@ def test_almalinux_8_os_grains(): } _run_os_grains_tests(_os_release_data, {}, expectation) +@pytest.mark.skip_unless_on_linux +def test_virtuozzo_7_os_grains(): + """ + Test if OS grains are parsed correctly in Virtuozzo 7 + """ + _os_release_data = { + "NAME": "Virtuozzo", + "ID": "virtuozzo", + "PRETTY_NAME": "Virtuozzo release 7.5.4", + "VERSION": "7.5.4", + "ID_LIKE": "rhel fedora", + "VERSION_ID": "7", + "ANSI_COLOR": "0;31", + "CPE_NAME": "cpe:/o:virtuozzoproject:vz:7", + "HOME_URL": "http://www.virtuozzo.com", + "BUG_REPORT_URL": "https://bugs.openvz.org", + } + expectation = { + "os": "Virtuozzo", + "os_family": "RedHat", + "osfullname": "Virtuozzo", + "oscodename": "Virtuozzo release 7.5.4", + "osrelease": "7", + "osrelease_info": (7), + "osmajorrelease": 7, + "osfinger": "Virtuozzo-7", + } + _run_os_grains_tests(_os_release_data, {}, expectation) + + @pytest.mark.skip_unless_on_linux def test_endeavouros_os_grains():