From 68c57474e1f7d66245509f6b8753e8165f42d9de Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Mon, 26 Jun 2017 13:19:45 +0000 Subject: [PATCH] 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 --- openstack_dashboard/utils/settings.py | 5 ++++- ...gin-enabled-override-f317e7c9c352f58f.yaml | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/plugin-enabled-override-f317e7c9c352f58f.yaml diff --git a/openstack_dashboard/utils/settings.py b/openstack_dashboard/utils/settings.py index 8f7487329e..65b26c4295 100644 --- a/openstack_dashboard/utils/settings.py +++ b/openstack_dashboard/utils/settings.py @@ -48,7 +48,10 @@ def import_dashboard_config(modules): elif (hasattr(submodule, 'PANEL') or hasattr(submodule, 'PANEL_GROUP') 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: logging.warning("Skipping %s because it doesn't have DASHBOARD" ", PANEL, PANEL_GROUP, or FEATURE defined.", diff --git a/releasenotes/notes/plugin-enabled-override-f317e7c9c352f58f.yaml b/releasenotes/notes/plugin-enabled-override-f317e7c9c352f58f.yaml new file mode 100644 index 0000000000..5e3afcc0ac --- /dev/null +++ b/releasenotes/notes/plugin-enabled-override-f317e7c9c352f58f.yaml @@ -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.