plugin framework: allow operators to override embeded enabled files
At now, the horizon plugin framework does not allow to override default panel settings by same filename. The embeded enabled files are always processed, so this leads to make operators difficult to change the order of panels from the default. In the original design of the plugin mechanism, we allow to override embeded enabled files by local/enabled files. For more detail, see bug 1700325. This commit changes import_dashboard_config to override an embeded enabled file by specifying a enabled file in local/enabled with the same filename. Closes-Bug: #1700325 Change-Id: Id6b15848206a684eca850a8f510a8ba1608bb7bf
This commit is contained in:
parent
a694f439da
commit
68c57474e1
@ -48,7 +48,10 @@ def import_dashboard_config(modules):
|
|||||||
elif (hasattr(submodule, 'PANEL')
|
elif (hasattr(submodule, 'PANEL')
|
||||||
or hasattr(submodule, 'PANEL_GROUP')
|
or hasattr(submodule, 'PANEL_GROUP')
|
||||||
or hasattr(submodule, 'FEATURE')):
|
or hasattr(submodule, 'FEATURE')):
|
||||||
config[submodule.__name__] = submodule.__dict__
|
# If enabled and local.enabled contains a same filename,
|
||||||
|
# the file loaded later (i.e., local.enabled) will be used.
|
||||||
|
name = submodule.__name__.rsplit('.', 1)[1]
|
||||||
|
config[name] = submodule.__dict__
|
||||||
else:
|
else:
|
||||||
logging.warning("Skipping %s because it doesn't have DASHBOARD"
|
logging.warning("Skipping %s because it doesn't have DASHBOARD"
|
||||||
", PANEL, PANEL_GROUP, or FEATURE defined.",
|
", PANEL, PANEL_GROUP, or FEATURE defined.",
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
[:bug:`1700325`] Horizon now allows to override an embeded default plugin
|
||||||
|
enabled file by specifying an enabled plguin file with a same filename.
|
||||||
|
If there are plugin enabled files with a same name both in ``enabled`` and
|
||||||
|
``local/enabled`` directories, the file in ``local/enabled`` will be used
|
||||||
|
and the file in ``enabled`` will be ignored now.
|
||||||
|
Previously, both files are processed in the order of ``enabled`` and then
|
||||||
|
``local/enabled`` in this case, but this made operators difficult to change
|
||||||
|
the order of panels from the default order.
|
||||||
|
|
||||||
|
This is useful when you would like to disable some default panel.
|
||||||
|
You can do it by specifying ``DISABLED = True`` in a plugin enabled file
|
||||||
|
in ``local/enabled`` directory with a same name.
|
||||||
|
|
||||||
|
This works in most cases, but there is a case where you need to be careful
|
||||||
|
when upgrading horizon. If you use ``REMOVE_PANEL`` to remove some default
|
||||||
|
panel by putting a plugin enabled file with a same name in
|
||||||
|
``local/enabled`` directory, you now need to use ``DISABLED = True`` or
|
||||||
|
change the filename.
|
Loading…
Reference in New Issue
Block a user