vzhestkov / saline-origin

Salt state appliement monitoring and automation tool
5 stars 1 forks source link

salined broken since the 1st of January due to salt.log.setup #2

Closed tacerus closed 8 months ago

tacerus commented 10 months ago

Hi,

salined run fine for some time on our Leap 15.5 based Salt Master (no SUMA), but failed with the new year - apparently there was a time bomb slumbering in the code:

Jan 12 13:47:08 witch1 systemd[1]: Started Saline Daemon.
Jan 12 13:47:08 witch1 salined[19606]: [INFO    ] Setting up the Saline
Jan 12 13:47:09 witch1 salined[19606]: [ERROR   ] An un-handled exception was caught by Salt's global exception handler:
Jan 12 13:47:09 witch1 salined[19606]: RuntimeError: Please stop using 'salt.log.setup' and instead use 'salt._logging'. 'salt.log.setup' will go away after 2024-01-01. Do note however that 'salt._logging' is now considered a non public implementation and is subject to change without deprecations. This warning(now exception) triggered on filename '<frozen importlib._bootstrap_external>', line number 678, is supposed to be shown until 2024-01-01. Today is 2024-01-12. Please remove the warning.
Jan 12 13:47:09 witch1 salined[19606]: Traceback (most recent call last):
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/bin/salined", line 9, in <module>
Jan 12 13:47:09 witch1 salined[19606]:     saline_daemon()
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/saline/scripts.py", line 18, in saline_daemon
Jan 12 13:47:09 witch1 salined[19606]:     saline.start()
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/saline/daemon.py", line 108, in start
Jan 12 13:47:09 witch1 salined[19606]:     super().start()
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/salt/utils/parsers.py", line 1053, in start
Jan 12 13:47:09 witch1 salined[19606]:     self.prepare()
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/saline/daemon.py", line 72, in prepare
Jan 12 13:47:09 witch1 salined[19606]:     import saline.process
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/saline/process.py", line 26, in <module>
Jan 12 13:47:09 witch1 salined[19606]:     from salt.log.setup import get_multiprocessing_logging_queue
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/salt/log/__init__.py", line 14, in <module>
Jan 12 13:47:09 witch1 salined[19606]:     from salt.log.setup import (
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/salt/log/setup.py", line 29, in <module>
Jan 12 13:47:09 witch1 salined[19606]:     stacklevel=4,
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/salt/utils/versions.py", line 251, in warn_until_date
Jan 12 13:47:09 witch1 salined[19606]:     today=today.isoformat(),
Jan 12 13:47:09 witch1 salined[19606]: RuntimeError: Please stop using 'salt.log.setup' and instead use 'salt._logging'. 'salt.log.setup' will go away after 2024-01-01. Do note however that 'salt._logging' is now considered a non public implementation and is subject to change without deprecations. This warning(now exception) triggered on filename '<frozen importlib._bootstrap_external>', line number 678, is supposed to be shown until 2024-01-01. Today is 2024-01-12. Please remove the warning.
Jan 12 13:47:09 witch1 salined[19606]: Traceback (most recent call last):
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/bin/salined", line 9, in <module>
Jan 12 13:47:09 witch1 salined[19606]:     saline_daemon()
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/saline/scripts.py", line 18, in saline_daemon
Jan 12 13:47:09 witch1 salined[19606]:     saline.start()
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/saline/daemon.py", line 108, in start
Jan 12 13:47:09 witch1 salined[19606]:     super().start()
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/salt/utils/parsers.py", line 1053, in start
Jan 12 13:47:09 witch1 salined[19606]:     self.prepare()
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/saline/daemon.py", line 72, in prepare
Jan 12 13:47:09 witch1 salined[19606]:     import saline.process
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/saline/process.py", line 26, in <module>
Jan 12 13:47:09 witch1 salined[19606]:     from salt.log.setup import get_multiprocessing_logging_queue
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/salt/log/__init__.py", line 14, in <module>
Jan 12 13:47:09 witch1 salined[19606]:     from salt.log.setup import (
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/salt/log/setup.py", line 29, in <module>
Jan 12 13:47:09 witch1 salined[19606]:     stacklevel=4,
Jan 12 13:47:09 witch1 salined[19606]:   File "/usr/lib/python3.6/site-packages/salt/utils/versions.py", line 251, in warn_until_date
Jan 12 13:47:09 witch1 salined[19606]:     today=today.isoformat(),
Jan 12 13:47:09 witch1 salined[19606]: RuntimeError: Please stop using 'salt.log.setup' and instead use 'salt._logging'. 'salt.log.setup' will go away after 2024-01-01. Do note however that 'salt._logging' is now considered a non public implementation and is subject to change without deprecations. This warning(now exception) triggered on filename '<frozen importlib._bootstrap_external>', line number 678, is supposed to be shown until 2024-01-01. Today is 2024-01-12. Please remove the warning.
Jan 12 13:47:09 witch1 systemd[1]: salined.service: Main process exited, code=exited, status=1/FAILURE
Jan 12 13:47:09 witch1 systemd[1]: salined.service: Failed with result 'exit-code'.

The relevant part is:

 'salt.log.setup' will go away after 2024-01-01.

I tried to follow the suggestion reported in the error, replacing the import salt.log.setup with salt._logging, but unfortunately salt._logging does not export get_multiprocessing_logging_queue and I couldn't find what the alternative for get_multiprocessing_logging_queue is.

I'm a bit confused however by:

Today is 2024-01-14. Please remove the warning.

Does this mean it should instead be patched out in our Salt package? Would appreciate any ideas!

tacerus commented 10 months ago

I currently hacked around this by hotpatching the system files, which is of course far from ideal:

sed -i s/20240101/20250101/ /usr/lib/python3.6/site-packages/salt/log/setup.py /usr/lib/python3.6/site-packages/salt/log/__init__.py

At least, slightly better than turning back my system time. :-)

vzhestkov commented 8 months ago

@tacerus Sorry I missed the issue, the fix is already there, but I forget to publish it in release, the devel is in place. Will push to release tomorrow.

vzhestkov commented 8 months ago

This was the fix BTW: https://github.com/vzhestkov/saline/commit/06818a9b634116ce3823309f5607135553d9f7ec Crazy thing that the code causing it was not used already and left there by accident.

tacerus commented 8 months ago

Thanks for the input. Nice to see it's such an easy solution, I feared a big refactoring! :-)

vzhestkov commented 8 months ago

Actually I just had no time to finish with release, but in the devel package in OBS it was fixed almost the same day as you reported it. I just pushed the changes to OBS, so the package will be available soon. Thank you for your report and sorry that I missed it.

I'm not closing the issue now, please close it after testing the updated package.

tacerus commented 8 months ago

Thanks! Will update ours (https://build.opensuse.org/request/show/1158992) and let you know.

tacerus commented 8 months ago

Updated (and re-installed python3-salt to revert my hotpatches) - all working fine! Thank you!