Skip to content

Commit

Permalink
Fix version part of osfinger on Pop!_OS
Browse files Browse the repository at this point in the history
Pop!_OS uses the same version scheme than Ubuntu (YY.MM) and releases
every six month in April and October. Using only the year from the
version in the `osfinger` does not allow differentiating between 20.04
and 20.10. Both has the `osfinger` set to `Pop-20`.

So include the full version in the `osfinger` grain.

Signed-off-by: Benjamin Drung <[email protected]>
  • Loading branch information
bdrung authored and garethgreenaway committed Sep 30, 2022
1 parent bb8db0f commit 8d243d5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog/61619.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pop!_OS uses the full version (YY.MM) in the osfinger grain now, not just the year. This allows differentiating for example between 20.04 and 20.10.
2 changes: 1 addition & 1 deletion salt/grains/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2258,7 +2258,7 @@ def _osrelease_data(os, osfullname, osrelease):
os_name = osfullname
grains["osfinger"] = "{}-{}".format(
os_name,
osrelease if os_name in ("Ubuntu",) else grains["osrelease_info"][0],
osrelease if os in ("Ubuntu", "Pop") else grains["osrelease_info"][0],
)

return grains
Expand Down
4 changes: 2 additions & 2 deletions tests/pytests/unit/grains/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ def test_pop_focal_os_grains():
"osrelease": "20.04",
"osrelease_info": (20, 4),
"osmajorrelease": 20,
"osfinger": "Pop-20",
"osfinger": "Pop-20.04",
}
_run_os_grains_tests(None, _os_release_map, expectation)

Expand All @@ -1264,7 +1264,7 @@ def test_pop_impish_os_grains():
"osrelease": "21.10",
"osrelease_info": (21, 10),
"osmajorrelease": 21,
"osfinger": "Pop-21",
"osfinger": "Pop-21.10",
}
_run_os_grains_tests(None, _os_release_map, expectation)

Expand Down

0 comments on commit 8d243d5

Please sign in to comment.