Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webui: fix and improve update check #1809

Merged

Conversation

joergsteffens
Copy link
Member

@joergsteffens joergsteffens commented May 8, 2024

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

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

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-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Required backport PRs have been created
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)

Copy link
Collaborator

@sebastianlederer sebastianlederer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@joergsteffens
Copy link
Member Author

I improved the handling of retrieving the updates. After that, the problem did no longer occur in my environment.

Copy link
Collaborator

@sebastianlederer sebastianlederer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that fixed it in my tests.

@BareosBot BareosBot force-pushed the dev/joergs/master/webui-update-status branch from ad5dc4d to 7311ab2 Compare May 28, 2024 16:43
@BareosBot BareosBot merged commit 3f33268 into bareos:master May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants