Removing admin and/or project dashboard causes error on login

Bug #1293727 reported by Charles Prince
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
David Lyle

Bug Description

I was trying to replace the admin dashboard with a new plugin dashboard of my own. I added the correct files in openstack_dashboard/local/enabled to disable the admin dashboard, and to plug in my new dashboard. I implemented my own get_user_home() function which returned the new dashboard, and set the correct value in local_settings.py. But, after login, I got an error saying that the admin dashboard was not registered. (See the attached screenshot.)

The admin dashboard not being registered makes perfect sense, but it doesn't make sense that Horizon would even try to access it.

I believe the problem is in the splash() function in openstack_dashboard/views.py -- specifically, it directly calls the get_user_home() function in the same module. When I change that call to "horizon.get_user_home(request.user)" it seems to work correctly.

Revision history for this message
Charles Prince (charles-prince) wrote :
Revision history for this message
LIU Yulong (dragon889) wrote :

you must disable such lines.

return horizon.get_dashboard('admin').get_absolute_url()

or change get_dashboard('admin') to get_dashboard('what you define')

Revision history for this message
Charles Prince (charles-prince) wrote :

I agree -- except that the code that is causing problems isn't in *my* code; it's in Horizon itself. I was using my own get_user_home() method to return my new dashboard:

def get_user_home(user):
    return get_dashboard('my_new_dashboard').get_absolute_url()

with a setting in local_settings.py:

HORIZON_CONFIG = {
   ...
   'user_home': 'path.to.my_new_dashboard.get_user_home',
   ...
}

But, the splash() function in Horizon isn't respecting that change -- it's directly calling its own get_user_home() function, which hard-codes the admin dashboard.

Revision history for this message
Charles Prince (charles-prince) wrote :

Looks like this has been addressed by the fix for bug #1301935.

Revision history for this message
Lin Hua Cheng (lin-hua-cheng) wrote :

Charles, can we close this bug?

Revision history for this message
David Lyle (david-lyle) wrote :

I don't think the linked fix resolves the underlying problem. The default behavior with the linked fix is to still use get_user_home. Which has the same hardcoded dependency on admin and project dashboards existing.

Changed in horizon:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → David Lyle (david-lyle)
milestone: none → juno-1
Revision history for this message
Charles Prince (charles-prince) wrote :

David, the linked fix uses "horizon.get_user_home()", which allows the get_user_home function to be specified in local_settings.py. So, the default behavior does still use the same get_user_home function, but it no longer precludes anyone else from overriding it.

Lin, yes, please go ahead and close the bug. I tried to find a way to mark it as a duplicate, but had no luck.

Revision history for this message
David Lyle (david-lyle) wrote :

The bug is still valid. Yes, there is a workaround by specifying you own get_user_home, but the default behavior should not throw and exception when supported functionality to remove the admin dashboard or the project dashboard is exercised.

Revision history for this message
Charles Prince (charles-prince) wrote :

Hmm ... OK, I see that. From my perspective, if you remove the admin and/or project dashboard, and don't replace it with something else, that's *your* problem. :-)

For anything *I* needed, the other fix was sufficient.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/87053

Changed in horizon:
status: Confirmed → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/87053
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=0c1a0a70154ddf107a6174d49793e369d28f1beb
Submitter: Jenkins
Branch: master

commit 0c1a0a70154ddf107a6174d49793e369d28f1beb
Author: David Lyle <email address hidden>
Date: Fri Apr 11 16:26:35 2014 -0600

    Fix default get_user_home with dynamic dashboards

    The existing get_user_home implementation expects both the 'admin'
    and 'project' dashboards to exist and throws an exception if they
    are missing. With the inclusion of configurable dashboard loading,
    we can no longer count on certain dashboards being loaded.

    Closes-Bug: #1293727

    Change-Id: I4ee0b7b313f4e1b27c0daea829c8b38282fa78d9

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.