Skip to content

Backend Python API crashing, and a typo in the code is preventing the system from sending an error message. #34

@rvhattem

Description

@rvhattem

Running Docker on Ubuntu server on a PI4 I found this when test-sending email notifications that didn't arrive without any UI feedback:


1). Watchdog crash:
AttributeError: module 'system_info_lib' has no attribute 'get_os_description'
This kills the main P1Watchdog.py script (it fails on line 341). Likely the Python library inside the image is either outdated or incomplete and missing that function.


2). Failure polling the backend to check the WiFi status:
Exception: Info.nmcli_lib.wifi_essid: cmd /usr/bin/sudo nmcli -t dev wifi list failed
The web interface is continuously polling the backend to check the WiFi status. The backend tries to execute sudo nmcli to scan for SSIDs.
Because it is running inside an isolated Docker container on Ubuntu server, it doesn't have sudo privileges, and it doesn't have access to the host's NetworkManager. The command fails and returns a NoneType object, crashing the wifi_lib.py script.


3). The typo that hides the errors:
TypeError: init() got an unexpected keyword argument 'titel'
By manually patching the container (search/replace) I was able to fix the email notifications:
docker exec -it p1mon /bin/bash -c "sed -i 's/titel=/title=/g' /p1mon/scripts/*.py"


To prevent the Watchdog crashes:


docker exec -it p1mon /bin/bash -c "sed -i 's/rt_status_db.strset( system_info_lib.get_os_description()/# rt_status_db.strset( system_info_lib.get_os_description()/g' /p1mon/scripts/P1Watchdog.py"


I hope this helps and that it can be incorporated in a future release. I'm not an expert and had to use Gemini to figure this out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions