fusion44 / blitz_api

A management backend for the RaspiBlitz project written in Python / FastAPI
MIT License
19 stars 18 forks source link

SSE: installed_app_status doesn't update when app was installed/uninstalled #184

Closed cstenglein closed 1 year ago

cstenglein commented 1 year ago

With 1.9.0rc

To reproduce: Uninstall app over webUI. Message will not disappear.

rootzoll commented 1 year ago

@fusion44 any updates on this bug? Would be great to have it fixed for RC2

fusion44 commented 1 year ago

I'll take another look at this throughout the coming weekend.

fusion44 commented 1 year ago

I guess installed_app_status is never pushed to the SSE channel because it seems like every app uninstall fails currently API wise, but succeeds on the Blitz. Here's what I get when I install JAM:

https://github.com/fusion44/blitz_api/assets/503952/01b9855a-9c80-46c4-8914-cd60e3fc6c3e

Blitz API logs:

May 14 18:19:03 python[4081732]: 2023-05-14 18:19:03 | ℹ️ | logging.py:87 | 127.0.0.1:40034 - "POST /apps/uninstall/jam HTTP/1.0" 200
May 14 18:19:03 sudo[267127]: blitzapi : PWD=/home/blitzapi/blitz_api ; USER=root ; COMMAND=/usr/bin/ls /etc/systemd/system/joinmarket-api.service
May 14 18:19:03 sudo[267127]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1003)
May 14 18:19:03 sudo[267127]: pam_unix(sudo:session): session closed for user root
May 14 18:19:03 sudo[267138]: blitzapi : PWD=/home/blitzapi/blitz_api ; USER=root ; COMMAND=/usr/bin/systemctl stop joinmarket-api
May 14 18:19:03 sudo[267138]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1003)
May 14 18:19:04 sudo[267138]: pam_unix(sudo:session): session closed for user root
May 14 18:19:04 sudo[267234]: blitzapi : PWD=/home/blitzapi/blitz_api ; USER=root ; COMMAND=/usr/bin/systemctl disable joinmarket-api
May 14 18:19:04 sudo[267234]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1003)
May 14 18:19:05 sudo[267234]: pam_unix(sudo:session): session closed for user root
May 14 18:19:05 sudo[267316]: blitzapi : PWD=/home/blitzapi/blitz_api ; USER=root ; COMMAND=/usr/bin/rm -f /etc/systemd/system/joinmarket-api.service
May 14 18:19:05 sudo[267316]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1003)
May 14 18:19:05 sudo[267316]: pam_unix(sudo:session): session closed for user root
May 14 18:19:05 sudo[267322]: blitzapi : PWD=/home/blitzapi/blitz_api ; USER=root ; COMMAND=/usr/sbin/ufw delete allow from any to any port 7500
May 14 18:19:05 sudo[267322]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1003)
... lots of similar messages hidden
May 14 18:19:18 python[4081732]: 2023-05-14 18:19:18 | ℹ️ | raspiblitz.py:232 | WRITING LOG FILE: /var/cache/raspiblitz/temp/install.jam.log
May 14 18:19:18 python[4081732]: 2023-05-14 18:19:18 | ❌ | raspiblitz.py:263 | NO `result=` returned by script:

And here's the generated log file for the uninstall (/var/cache/raspiblitz/temp/install.jam.log):

API triggered script: bash /home/admin/config.scripts/bonus.jam.sh off --delete-data
###### STDOUT #######
# *** DEACTIVATE JAM ***
# Cleaning up Jam install ...
# OK, Jam is removed

###### STDERR #######
Rule deleted
Rule deleted (v6)
Rule deleted
Rule deleted (v6)
rm: cannot remove '2/dev/null': No such file or directory
rm: cannot remove '2/dev/null': No such file or directory
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# OK service is removed - reloading Tor ...
# Done
rootzoll commented 1 year ago

@fusion44 JAM is now returning a resilt status on uninstall - see https://github.com/rootzoll/raspiblitz/pull/3844