Uninett / zino

Zino 2.0 - Network state monitor for research networks
Apache License 2.0
3 stars 5 forks source link

Hard to find faults/typos in polldevs.cf #247

Closed runborg closed 3 months ago

runborg commented 3 months ago

When writing incorrect settings into polldevs.cf the error message presented to the user is kinda hard to read. there are also no information about where in the file the issue is located. It also looks like the pydantic error field required message is truncated as then no usefull information is presented to the user

Traceback (most recent call last):
  File "/home/runarb/zino2/zino-env/lib/python3.10/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
    retval = await job.func(*job.args, **job.kwargs)
  File "/home/runarb/zino2/zino-env/lib/python3.10/site-packages/zino/scheduler.py", line 70, in load_and_schedule_polldevs
    new_devices, deleted_devices = load_polldevs(polldevs_conf)
  File "/home/runarb/zino2/zino-env/lib/python3.10/site-packages/zino/scheduler.py", line 46, in load_polldevs
    devices = {d.name: d for d in read_polldevs(polldevs_conf)}
  File "/home/runarb/zino2/zino-env/lib/python3.10/site-packages/zino/scheduler.py", line 46, in <dictcomp>
    devices = {d.name: d for d in read_polldevs(polldevs_conf)}
  File "/home/runarb/zino2/zino-env/lib/python3.10/site-packages/zino/config/polldevs.py", line 20, in read_polldevs
    yield PollDevice(**(defaults | section))
  File "/home/runarb/zino2/zino-env/lib/python3.10/site-packages/pydantic/main.py", line 164, in __init__
    __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
pydantic_core._pydantic_core.ValidationError: 1 validation error for PollDevice
name
  Field required [type=missing, input_value={'interval': '5', 'commun...0.159', 'timeout': '11'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.5/v/missing