Allow changing any horizon settings from the plugin config files
Sometimes we want our pluggable dashboard to change more than just the selected handful of options in the HORIZON_CONFIG. This patch lets the configuration files for the plugins add and modify any horizon settings. Change-Id: I25aec577733631d1e2057bde0b12f1e50c56b05b Closes-bug: #1302387
This commit is contained in:
parent
47ac664849
commit
2d6d3e76af
@ -673,6 +673,14 @@ The name of the dashboard the ``PANEL_GROUP`` associated with. Required.
|
||||
|
||||
If set to ``True``, this panel configuration will be skipped.
|
||||
|
||||
``UPDATE_HORIZON_CONFIG``
|
||||
-------------------------
|
||||
|
||||
A dictionary of values that will replace the values in ``HORIZON_CONFIG``. The
|
||||
order in which this setting is applied is the same as for the other pluggable
|
||||
settings, and is described at the beginning of this section.
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
|
@ -89,6 +89,7 @@ def update_dashboards(modules, horizon_config, installed_apps):
|
||||
exceptions = {}
|
||||
apps = []
|
||||
panel_customization = []
|
||||
update_horizon_config = {}
|
||||
for key, config in import_dashboard_config(modules):
|
||||
if config.get('DISABLED', False):
|
||||
continue
|
||||
@ -99,9 +100,12 @@ def update_dashboards(modules, horizon_config, installed_apps):
|
||||
apps.extend(config.get('ADD_INSTALLED_APPS', []))
|
||||
if config.get('DEFAULT', False):
|
||||
horizon_config['default_dashboard'] = dashboard
|
||||
update_horizon_config.update(
|
||||
config.get('UPDATE_HORIZON_CONFIG', {}))
|
||||
elif config.get('PANEL') or config.get('PANEL_GROUP'):
|
||||
panel_customization.append(config)
|
||||
horizon_config['panel_customization'] = panel_customization
|
||||
horizon_config['dashboards'] = tuple(dashboards)
|
||||
horizon_config['exceptions'].update(exceptions)
|
||||
horizon_config.update(update_horizon_config)
|
||||
installed_apps[:] = apps + installed_apps
|
||||
|
Loading…
Reference in New Issue
Block a user