Open p-try opened 9 months ago
The PR is good, however it breaks backward compatibility with older systems, using an older Python version. importlib.metadata (https://docs.python.org/3/library/importlib.metadata.html) was added in Python 3.8. Some users (unfortunately) still use older systems with an older Python version - mainly RHEL 7 which ships Python 2.7 and 3.6 by default.
RHEL 7 is EOL end of June this year. I guess we can in July make a new release of the check_esxi_hardware plugin and set new requirements. EOL systems would no longer be supported and need to use an older version of the plugin.
So let's keep this in "backlog" and look at this again later this year when the last "big" OS releases stop supporting very old Python versions.
In the meantime, as a workaround, you could ignore the deprecation warnings: https://stackoverflow.com/questions/879173/how-to-ignore-deprecation-warnings-in-python
Ping about this - RHEL 7 and python 3.7 (and earlier) are out of support now (Oct 2024)
Thanks for the reminder. Yes, it's time now. I will work on this soon.
Alright there are a couple of things to consider:
pkg_resources
is deprecated in favor of importlib.resources
, as stated in https://setuptools.pypa.io/en/latest/pkg_resources.html. importlib
was only added in Python 3.7. There are active LTS Linux versions around, which still ship with Python 3.6 (EL 8). This means using importlib
could lead to other unwanted dependency problems and for the sake of compatibility we should not replace pkg_resources
with importlib
just yet.pkg_resources
was used in the first place was to identify the pywbem module version. There were significant differences between the "original" pywbem 0.7 and newer releases. However pywbem 0.7 is nowhere shipped anymore, in current active Linux distributions. EL8 for example ships python3-pywbem 0.11.0, Debian based distributions have completely removed the python3-pywbem package (can only be installed using pip now). The last Ubuntu LTS was 18.04 (Bionic) which shipped pywbem 0.8.0.Now looking at this and assuming pywbem 0.7.0 is now definitely gone in active setups, I guess it's safe to remove the "different pywbem version handling" in the plugin. If, in the future, we run into new compatibility issues between certain pywbem versions, then we can use pywbem.__version__
which was added after pywbem 0.7.0 (don't remember the exact release).
Besides this, all active Linux distributions, including LTS releases, come with python3
. There might still be some older LTS releases out there which ship both python2
and python3
, but this means that python3
is available on all active setups. This means we can also get rid of the "python2 to python3 translation" (for the print function).
All, please have a look at #73 and let me know your thoughts. In the meantime I deploy the python3 only plugin on my monitoring environments to verify everything works.
FYI, I plan to release the new version (python3 only) on November 1st 2024, unless a blocker-comment comes up in between.
Before actually creating a new issue I confirm, I have read the FAQ (https://www.claudiokuenzler.com/blog/308/check-esxi-hardware-faq-frequently-asked-questions): Y I confirm, I have restarted the CIM server (
/etc/init.d/sfcbd-watchdog restart
) on the ESXi server and the problem remains: Y I confirm, I have cleared the server's local IPMI cache (localcli hardware ipmi sel clear
) and restarted the services (/sbin/services.sh restart
) on the ESXi server and the problem remains: YDescribe the bug The script uses the following code to check the version of pywbem:
A deprecation warning appears:
DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
Expected behavior Output should not contain the deprecation warning.
Versions: