zamentur / yunomonitor

Easy monitoring for YunoHost
GNU Affero General Public License v3.0
6 stars 2 forks source link

YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated #2

Open olberger opened 1 year ago

olberger commented 1 year ago

I installed yunomonitor inside a YNH server running 11.1.1.2, and got nothing really happening. Investigating the timer service I checked to run it manually and got:

root@ynh:/opt/yunomonitor# /opt/yunomonitor/yunomonitor.py -c /opt/yunomonitor/conf/yunomonitor.yml
/opt/yunomonitor/yunomonitor.py:321: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  config = yaml.load(local_config_file)
INFO:root:CHECKING EACH SERVERS...
INFO:root:[localhost] CONFIGURING...
/opt/yunomonitor/yunomonitor.py:747: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  app_settings = yaml.load(settings_file)
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/opt/yunomonitor/yunomonitor.py", line 448, in run
    self.ynh_maps[self.server] = self._load_monitoring_config()
  File "/opt/yunomonitor/yunomonitor.py", line 488, in _load_monitoring_config
    config = generate_monitoring_config()
  File "/opt/yunomonitor/yunomonitor.py", line 778, in generate_monitoring_config
    "label": app_settings['label'],
KeyError: 'label'
INFO:root:FILTERING...
INFO:root:MAILING...

Hope this helps,

olberger commented 1 year ago

It seems one may get rid of the warnings by replacing load() by safe_load()...

But then, back to :

/opt/yunomonitor/yunomonitor.py -c /opt/yunomonitor/conf/yunomonitor.yml
INFO:root:CHECKING EACH SERVERS...
INFO:root:[localhost] CONFIGURING...
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/opt/yunomonitor/yunomonitor.py", line 448, in run
    self.ynh_maps[self.server] = self._load_monitoring_config()
  File "/opt/yunomonitor/yunomonitor.py", line 488, in _load_monitoring_config
    config = generate_monitoring_config()
  File "/opt/yunomonitor/yunomonitor.py", line 778, in generate_monitoring_config
    "label": app_settings['label'],
KeyError: 'label'
INFO:root:FILTERING...
INFO:root:MAILING...
olberger commented 1 year ago

It seems one may get rid of the warnings by replacing load() by safe_load()...

But then, back to :

/opt/yunomonitor/yunomonitor.py -c /opt/yunomonitor/conf/yunomonitor.yml
INFO:root:CHECKING EACH SERVERS...
INFO:root:[localhost] CONFIGURING...
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/opt/yunomonitor/yunomonitor.py", line 448, in run
    self.ynh_maps[self.server] = self._load_monitoring_config()
  File "/opt/yunomonitor/yunomonitor.py", line 488, in _load_monitoring_config
    config = generate_monitoring_config()
  File "/opt/yunomonitor/yunomonitor.py", line 778, in generate_monitoring_config
    "label": app_settings['label'],
KeyError: 'label'
INFO:root:FILTERING...
INFO:root:MAILING...

OK, I guess that one is another beast : apps having no labels ? Fill handle in a separate issue