Fix crashes when failing to load hosting services during repo config.

Review Request #12983 — Created April 24, 2023 and submitted

Information

Review Board
release-5.0.x

Reviewers

Repositories backed by hosting services could crash both the repository
list in the administration UI and the repository configuration form.
Assumptions were being made about whether a HostingService could be
loaded, and this meant we weren't catching exceptions.

The repository list now catches this case when trying to render the
hosting service name, and falls back on showing the stored ID instead,
along with a "(missing support)" suffix.

The repository configuration form catches this in a couple of spots as
well, allowing the form to load even if a hosting service can't.

There are still problems that can occur with rendering information for
SCMTools, due to the fact that they can be loaded from entrypoints, but
those are beyond the scope of this change.

Tested loading my repository list and config form while Power Pack was
uninstalled. Saw that both pages successfully loaded, and that the
affected repositories had the new suffix.

Summary ID
Fix crashes when failing to load hosting services during repo config.
Repositories backed by hosting services could crash both the repository list in the administration UI and the repository configuration form. Assumptions were being made about whether a `HostingService` could be loaded, and this meant we weren't catching exceptions. The repository list now catches this case when trying to render the hosting service name, and falls back on showing the stored ID instead, along with a "(missing support)" suffix. The repository configuration form catches this in a couple of spots as well, allowing the form to load even if a hosting service can't. There are still problems that can occur with rendering information for SCMTools, due to the fact that they can be loaded from entrypoints, but those are beyond the scope of this change.
0bad98d2e2f44235a65f2a075730165869a1cf49
Description From Last Updated

'typing.TYPE_CHECKING' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

undefined name 'Type' Column: 43 Error code: F821

reviewbotreviewbot

undefined name 'HostingService' Column: 48 Error code: F821

reviewbotreviewbot

undefined name 'HostingService' Column: 39 Error code: F821

reviewbotreviewbot

Since you're here, mind adding a module docstring?

daviddavid
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. 
      
  2. reviewboard/hostingsvcs/models.py (Diff revision 2)
     
     
    Show all issues

    Since you're here, mind adding a module docstring?

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-6.x (78dd840)