mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Fill out lsb_distrib_xxx grains (best guess) if lsb_release information unavailable
This commit is contained in:
parent
28039bda69
commit
cd279bd7d4
3 changed files with 30 additions and 2 deletions
1
changelog/64473.fixed.md
Normal file
1
changelog/64473.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Fill out lsb_distrib_xxxx (best estimate) grains if problems with retrieving lsb_release data
|
|
@ -2175,8 +2175,9 @@ def _linux_distribution_data():
|
|||
"rocky",
|
||||
"ubuntu",
|
||||
):
|
||||
# Solely use os-release data. See description of the function.
|
||||
return grains
|
||||
if lsb_has_error is False:
|
||||
# Solely use os-release data. See description of the function.
|
||||
return grains
|
||||
|
||||
except OSError:
|
||||
os_release = {}
|
||||
|
|
26
tests/pytests/functional/grains/test_grains.py
Normal file
26
tests/pytests/functional/grains/test_grains.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
import logging
|
||||
|
||||
import pytest
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.skip_unless_on_linux,
|
||||
pytest.mark.skipif(
|
||||
'grains["os_family"] != "Debian"',
|
||||
reason="Tests applicable only to Debian and Ubuntu",
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
def test_grains(grains):
|
||||
log.warning(f"DGM test_grains '{grains}'")
|
||||
|
||||
assert "lsb_distrib_id" in grains
|
||||
assert "lsb_distrib_release" in grains
|
||||
assert "lsb_distrib_codename" in grains
|
||||
|
||||
assert grains["lsb_distrib_id"] == grains["osfullname"]
|
||||
assert grains["lsb_distrib_release"] == grains["osrelease"]
|
||||
assert grains["lsb_distrib_codename"] == grains["oscodename"]
|
Loading…
Add table
Reference in a new issue