Use os-release ID_LIKE for the os-family grain#60171
Use os-release ID_LIKE for the os-family grain#60171evelikov wants to merge 2 commits intosaltstack:masterfrom
Conversation
|
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. |
|
Please note, that the change itself is an internal detail and should not produce any visible changes. Thus I did not change the tests nor did I add any docs/changelog. More than happy to do as if needed. |
|
Can anyone share why the CI is failing - the output is truncated :-\ |
If you click on 'Details' on the failing job all the way at the bottom there is a link to the Jenkins build where you can check the console output, e.g. https://jenkins.saltproject.io/job/pr-ubuntu-2004-amd64-py3-pytest/job/PR-60171/1/console |
The os-release ID_LIKE property, defines what we essentially call "os_family". It can be a space separated list of IDs, starting with the most relevant one. Use it when possible and fall-back to the _OS_FAMILY_MAP otherwise. Looking into the future... Since os-release is a hard-requirement for nearly all modern Linux distributions, we could we could make it the canonical source at some point in the future. By doing so, we can remove all the distro specific *release files as well as lsb-release parsing. This will allow us to further simplify things by removing the majority of _OS_FAMILY_MAP. And if we start parsing the os-release ID, most of _OS_NAME_MAP can also be removed ;-) But all that for another day. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
These two platforms consistently set the os-release ID_LIKE properly which is handled with last commit. So drop the explicit entries from the table. In theory, nearly all Linux entries could be dropped although left for a later day. Enterprise distros et al, are less flexible to provide their os-release package making the audit process tad hard. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
3fffb95 to
6752be9
Compare
|
The logs are not so helpful why things are failing. Especially in the macosx case - the series does not touch any non-linux code. |
twangboy
left a comment
There was a problem hiding this comment.
This needs a changelog and a test case
|
@twangboy do you have any PR or anything else I can use as a reference? Also happy 1 year anniversary :-P |
|
Closing this due to inactivity. Anyone should feel free to re-open it if they want to see it through to the end in one release cycle. |
|
Fwiw my earlier question still stands: What tests are expected, is there a PR or documentation that can be used as a reference? |
|
@evelikov The following command gives lots of examples of testing grains, cut & paste & manipulate for the test to exercise your code changes. Testing a grain is pretty simple. For your changes, recommend doing a unit test since very simple change. |
|
@dmurphy18 thanks for the pointers. Looking through all those files - neither seem relevant to what's being achieved here. At a glance, the code should already be tested via the existing grains in In theory one can continue chipping/removing the hard-coded mappings in |
What does this PR do?
This MR parses the
ID_LIKEtoken in theos-releasefile and uses it for theos-familygrain, before falling back to the old heuristics.As result this paves the way to more scale-able Linux distribution handling. In particular, today each new distro needs an entry in
_OS_FAMILY_MAP(and potentially_OS_NAME), while the information is readily available withinos-release. It also opens the path to cleanup the parsing of nonos-releaserelease files and remove the vast part of_OS_NAME_MAPand_OS_FAMILY_MAP.But all those can follow in due course.
What issues does this PR fix or reference?
Fixes:
Previous Behavior
os-familygrain is used based on theosgrain and_OS_FAMILY_MAPNew Behavior
os-familygrain is set to a valid distribution entry, as based onID_LIKEand_OS_NAME_MAP. If missing or invalid, we fallback to the old behaviour.Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.