webui: fix and improve update check#1809
Conversation
4786e0b to
0f8cdcd
Compare
There was a problem hiding this comment.
When download.bareos.com is not reachable to get the version info, the AuthController crashes and you only get a blank page.
Error log:
[Fri May 23 21:20:48 2024] PHP Warning: Trying to access array offset on value of type int in /build/bareos/review-pr-1809/bareos/webui/vendor/Bareos/library/Bareos/Util.php on line 38
[Fri May 23 21:20:48 2024] PHP Fatal error: Uncaught Error: Cannot use a scalar value as an array in /build/bareos/review-pr-1809/bareos/webui/vendor/Bareos/library/Bareos/Util.php:39
Stack trace:
#0 /build/bareos/review-pr-1809/bareos/webui/module/Auth/src/Auth/Controller/AuthController.php(307): Bareos\Util::getNearestVersionInfo()
In getVersionInfo() from Util.php the variable $bareos_supported_versions contains the following in the error case:
a:3:{s:10:"readyState";i:4;s:6:"status";i:404;s:10:"statusText";s:5:"error";} (output from serialize())
It probably expects a linear array of version info dictionaries.
Not sure why the status code is 404, because for this test the IP address of downloads.bareos.com was set to an unreachable IP address, so no HTTP request could have happened.
|
I improved the handling of retrieving the updates. After that, the problem did no longer occur in my environment. |
sebastianlederer
left a comment
There was a problem hiding this comment.
Yes, that fixed it in my tests.
ad5dc4d to
7311ab2
Compare
Thank you for contributing to the Bareos Project!
Before, the Bareos WebUI only displayed the clients update status, while the Director update status still used old, outdated code.
These changes now uses the same code and data to display the update status of the clients and the Director.
Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
Make sure you check/merge the PR using
devtools/pr-toolto have some simple automated checks run and a proper changelog record added.General
Source code quality