Fix version part of osfinger on Pop!_OS

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 <benjamin.drung@ionos.com>
This commit is contained in:
Benjamin Drung 2022-02-10 14:56:35 +01:00 committed by Gareth J. Greenaway
parent bb8db0ff5e
commit 8d243d5020
3 changed files with 4 additions and 3 deletions

1
changelog/61619.fixed Normal file
View file

@ -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.

View file

@ -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

View file

@ -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)
@ -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)