Skip to content
Open
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
1 change: 1 addition & 0 deletions changelog/68715.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added os_family mappings for additional Linux distributions.
4 changes: 4 additions & 0 deletions salt/grains/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1902,6 +1902,10 @@ def _derive_os_grain(osfullname, os_id=None):
"openSUSE Leap": "Suse",
"openSUSE Tumbleweed": "Suse",
"SLES_SAP": "Suse",
"alfaLinux": "Suse",
"alfaLinux Rise": "Suse",
"AlterOS": "RedHat",
"RED OS": "RedHat",
"Arch ARM": "Arch",
"Manjaro": "Arch",
"Manjaro ARM": "Arch",
Expand Down
93 changes: 93 additions & 0 deletions tests/pytests/unit/grains/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5608,3 +5608,96 @@ def test__ps():
"| awk '{ $7=\"\"; print }'"
)
}


@pytest.mark.skip_unless_on_linux
def test_alfalinux_os_grains():
_os_release_data = {
"NAME": "alfaLinux",
"PRETTY_NAME": "alfaLinux",
"ID": "alfalinux",
"VERSION_ID": "1",
}

expectation = {
"os": "alfaLinux",
"os_family": "Suse",
"osfullname": "alfaLinux",
"oscodename": "alfaLinux",
"osfinger": "alfaLinux-1",
"osrelease": "1",
"osrelease_info": (1,),
"osmajorrelease": 1,
}

_run_os_grains_tests(_os_release_data, {}, expectation)


@pytest.mark.skip_unless_on_linux
def test_alfalinux_rise_os_grains():
_os_release_data = {
"NAME": "alfaLinux Rise",
"PRETTY_NAME": "alfaLinux Rise",
"ID": "alfalinux-rise",
"VERSION_ID": "1",
}

expectation = {
"os": "alfaLinux Rise",
"os_family": "Suse",
"osfullname": "alfaLinux Rise",
"oscodename": "alfaLinux Rise",
"osfinger": "alfaLinux Rise-1",
"osrelease": "1",
"osrelease_info": (1,),
"osmajorrelease": 1,
}

_run_os_grains_tests(_os_release_data, {}, expectation)


@pytest.mark.skip_unless_on_linux
def test_alteros_os_grains():
_os_release_data = {
"NAME": "AlterOS",
"PRETTY_NAME": "AlterOS",
"ID": "alteros",
"VERSION_ID": "1",
}

expectation = {
"os": "AlterOS",
"os_family": "RedHat",
"osfullname": "AlterOS",
"oscodename": "AlterOS",
"osfinger": "AlterOS-1",
"osrelease": "1",
"osrelease_info": (1,),
"osmajorrelease": 1,
}

_run_os_grains_tests(_os_release_data, {}, expectation)


@pytest.mark.skip_unless_on_linux
def test_red_os_os_grains():
_os_release_data = {
"NAME": "RED OS",
"PRETTY_NAME": "RED OS",
"ID": "redos",
"VERSION_ID": "1",
}

expectation = {
"os": "RED OS",
"os_family": "RedHat",
"osfullname": "RED OS",
"oscodename": "RED OS",
"osfinger": "RED OS-1",
"osrelease": "1",
"osrelease_info": (1,),
"osmajorrelease": 1,
}

_run_os_grains_tests(_os_release_data, {}, expectation)
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably needs a new line here as well

Copy link
Author

Choose a reason for hiding this comment

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

My mistake, added again.