Honor dashboard DISABLED over horizon settings

Change-Id: I3324cdfb46ff2843dee01e00cdf9e46cbd827a70
Closes-Bug: #1350346
This commit is contained in:
Akihiro Motoki 2014-08-04 07:28:42 +09:00
parent 7414901c25
commit 5d39ff1d0d

View File

@ -84,7 +84,7 @@ def update_dashboards(modules, horizon_config, installed_apps):
deferred until the horizon autodiscover is completed, configurations are deferred until the horizon autodiscover is completed, configurations are
applied in alphabetical order of files where it was imported. applied in alphabetical order of files where it was imported.
""" """
dashboards = list(horizon_config.get('dashboards', [])) enabled_dashboards = []
exceptions = {} exceptions = {}
apps = [] apps = []
angular_modules = [] angular_modules = []
@ -102,13 +102,19 @@ def update_dashboards(modules, horizon_config, installed_apps):
config.get('UPDATE_HORIZON_CONFIG', {})) config.get('UPDATE_HORIZON_CONFIG', {}))
if config.get('DASHBOARD'): if config.get('DASHBOARD'):
dashboard = key dashboard = key
if dashboard not in dashboards: enabled_dashboards.append(dashboard)
dashboards.append(dashboard)
if config.get('DEFAULT', False): if config.get('DEFAULT', False):
horizon_config['default_dashboard'] = dashboard horizon_config['default_dashboard'] = dashboard
elif config.get('PANEL') or config.get('PANEL_GROUP'): elif config.get('PANEL') or config.get('PANEL_GROUP'):
config.pop("__builtins__", None) config.pop("__builtins__", None)
panel_customization.append(config) panel_customization.append(config)
# Preserve the dashboard order specified in settings
config_dashboards = horizon_config.get('dashboards', [])
dashboards = ([d for d in config_dashboards
if d in enabled_dashboards] +
[d for d in enabled_dashboards
if d not in config_dashboards])
horizon_config['panel_customization'] = panel_customization horizon_config['panel_customization'] = panel_customization
horizon_config['dashboards'] = tuple(dashboards) horizon_config['dashboards'] = tuple(dashboards)
horizon_config['exceptions'].update(exceptions) horizon_config['exceptions'].update(exceptions)