After PR https://github.com/ceph/ceph/pull/26572, when RGW is not
configured, accessing /rgw drop-down (daemons, users or buckets)
results in nothing apparently happening (not even an error).
Under the curtains, what is happening is that the ModuleStatusGuard
has redirected the route to the rgw/501, but as this route is now
under parent rgw route handler, which sets CanActivateChild guards,
this results in a new ModuleStatusGuard invokation, a subsequent
failure and a new redirection to rgw/501.
Several approaches could be taken here:
- Remove error pages from lazy-loaded modules. Probably it does not
make sense to have a 501 page per component.
- Add some whitelist to avoid this kind of loop (e.g.: 501, or any
error page).
- Set a max number of redirections (cautionary measure).
Fixes: https://tracker.ceph.com/issues/39125
Signed-off-by: Ernesto Puerta <epuertat@redhat.com>
(cherry picked from commit
c64b815386d9b7b89c69fb7e8387c7b7b7cf408c)
Signed-off-by: Ernesto Puerta <epuertat@redhat.com>
httpClient = TestBed.get(HttpClient);
router = TestBed.get(Router);
route = new ActivatedRouteSnapshot();
+ route.url = [];
route.data = {
moduleStatusGuardConfig: {
apiPath: 'bar',
providedIn: ServicesModule
})
export class ModuleStatusGuardService implements CanActivate, CanActivateChild {
+ // TODO: Hotfix - remove WHITELIST'ing when a generic ErrorComponent is implemented
+ static readonly WHITELIST: string[] = ['501'];
+
constructor(private http: HttpClient, private router: Router) {}
canActivate(route: ActivatedRouteSnapshot) {
}
private doCheck(route: ActivatedRouteSnapshot) {
+ if (route.url.length > 0 && ModuleStatusGuardService.WHITELIST.includes(route.url[0].path)) {
+ return observableOf(true);
+ }
const config = route.data['moduleStatusGuardConfig'];
return this.http.get(`/api/${config.apiPath}/status`).pipe(
map((resp: any) => {