-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
grains: Use platform.freedesktop_os_release #61589
Conversation
c6e3bfc
to
178b8a8
Compare
b58c854
to
3b2c5e5
Compare
Updated the code so that |
3fe0c4b
to
a78395c
Compare
a78395c
to
76c247e
Compare
76c247e
to
fa7775a
Compare
fa7775a
to
f9932ba
Compare
f9932ba
to
428aa39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, need to get all tests passing, updated against branch and hopefully Windows VM and Apple VM will behave
Ready to approve once all the tests pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to address Windows issues, no /etc/os-release on Windows
Restarted MacOS test, but nest check not same issue as on Windows
c9cca87
to
7ab5d4b
Compare
|
Change `_parse_os_release` to behave nearly identical to `platform.freedesktop_os_release` from Python >= 3.10, if called with ("/etc/os-release", "/usr/lib/os-release"). There are no os-release files for Pop!_OS and therefore the test cases would fail with an `OSError` now. Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
Python 3.10 introduced `platform.freedesktop_os_release` which does the same as `_parse_os_release("/etc/os-release", "/usr/lib/os-release")`. The parsing of the os-release files is nearly identical and differs only slightly in the used regular expressions. In contrast to `_parse_os_release`, `platform.freedesktop_os_release` caches the result of the parsed os-release file. Use `platform.freedesktop_os_release` when available. When salt drops the support for Python < 3.10 (some time in the distant future), `_parse_os_release` can be removed. Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
Update the OS grains test cases to use `/etc/os-release` data from still supported Debian/Ubuntu releases. Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
Update the OS grains test cases to use `/etc/os-release` data from the latest Rocky Linux release. Data is taken from Docker image `rockylinux:8`. Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
Update the OS grains test cases to use `/etc/os-release` data from the latest AlmaLinux release. Data is taken from docker image `almalinux:8`. Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
7ab5d4b
to
13a5f11
Compare
Making |
Python 3.10 introduced
platform.freedesktop_os_release
which does the same as_parse_os_release("/etc/os-release", "/usr/lib/os-release")
.The parsing of the os-release file is very similar and differs only slightly in the used regular expressions. In contrast to
_parse_os_release
,platform.freedesktop_os_release
caches the result of the parsed os-release file.Use
platform.freedesktop_os_release
when available. When salt drops the support for Python < 3.10 (some time in the distant future),_parse_os_release
can be removed.Also update the OS grains test cases to use /etc/os-release data from still supported Debian/Ubuntu releases.
This merge request contains the commits from the merge request #61597. So I recommend to review and merge #61597 first.