preserving dashboard order for update_dashboards call

the call to update_dashboards() can rewrite the existing order
of dashboards, especially a simple plugin is writen to just
add a panel to an existing dashboard

Change-Id: I67a8c58f4b367262c2d6d0df9d78ec4a5d7b944b
Closes-bug: #1342999
This commit is contained in:
Eric Peterson 2014-07-16 16:48:23 -06:00 committed by Eric Peterson
parent ad4eae9543
commit 19b23df0ef

View File

@ -85,7 +85,7 @@ def update_dashboards(modules, horizon_config, installed_apps):
deferred until the horizon autodiscover is completed, configurations are
applied in alphabetical order of files where it was imported.
"""
dashboards = []
dashboards = list(horizon_config.get('dashboards', []))
exceptions = {}
apps = []
angular_modules = []
@ -103,7 +103,8 @@ def update_dashboards(modules, horizon_config, installed_apps):
config.get('UPDATE_HORIZON_CONFIG', {}))
if config.get('DASHBOARD'):
dashboard = key
dashboards.append(dashboard)
if dashboard not in dashboards:
dashboards.append(dashboard)
if config.get('DEFAULT', False):
horizon_config['default_dashboard'] = dashboard
elif config.get('PANEL') or config.get('PANEL_GROUP'):