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 @@ -1903,6 +1903,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
84 changes: 84 additions & 0 deletions tests/pytests/unit/grains/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5639,3 +5639,87 @@ def _dir_side_effect(path):
grains = core.fibre_channel_host()
assert "fibre_channel_host" in grains
assert grains["fibre_channel_host"] is status


@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)
Comment thread
twangboy marked this conversation as resolved.
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.

pretty sure this needs a blank line. It's gonna fail pre-commit

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The file ends with 6E 29 0A - there is an empty line there.
I've already tried all the options, if this one doesn't work, I don't know what to do. )

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.

OK, if it passes pre-commit, I'll approve it.