From 3288a587f99c3a3fe2e3c57470b90f81a84d5d6f Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 24 Sep 2024 17:05:10 +0200 Subject: [PATCH] Link plugin settings extension separately At the moment Horizon plugins' local_settings are being symlinked to the enabled folder, which is not entirely correct. Today Horizon will produce a warning message during compression in case a settings file will be present in enabled folder, ie: WARNING:root:Skipping openstack_dashboard.local.enabled._1699_orchestration_settings because it doesn't have DASHBOARD, PANEL, PANEL_GROUP, or FEATURE defined. To avoid such warning settings files are being search and symlinked independently now. Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-openstack_hosts/+/930272 Change-Id: I5b50bad91f00cd4f5b5c36e30753e88425cf9d13 --- tasks/horizon_post_install_source.yml | 25 +++++++++++++++++++++++++ vars/main.yml | 1 + vars/source_install.yml | 4 +++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tasks/horizon_post_install_source.yml b/tasks/horizon_post_install_source.yml index 777ea7d1..a0f11191 100644 --- a/tasks/horizon_post_install_source.yml +++ b/tasks/horizon_post_install_source.yml @@ -51,6 +51,21 @@ use_regex: yes register: found_panels +- name: Registering settings + find: + paths: |- + {% set dashboard_path = [] %} + {% for dashboard in found_dashboards.files %} + {% for path in _dashboard_settings_location %} + {% set _ = dashboard_path.append(dashboard.path + path) %} + {% endfor %} + {% endfor %} + {{ dashboard_path }} + patterns: ["^_[0-9]{2,4}_.*.py$"] + file_type: file + use_regex: yes + register: found_settings + - name: Registering default policy files find: paths: |- @@ -99,6 +114,16 @@ notify: - Compile messages +- name: Enable project settings + file: + src: "{{ item.path }}" + path: "{{ horizon_dashboard_settings_dir }}/{{ item.path | basename }}" + state: link + with_items: "{{ found_settings.files }}" + notify: + - Compile messages + - Restart wsgi process + - name: Enable project panels file: src: "{{ item.path }}" diff --git a/vars/main.yml b/vars/main.yml index 570e1729..34fb1752 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -39,6 +39,7 @@ _horizon_translations_pull: module: trove_dashboard horizon_dashboard_panel_dir: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled" +horizon_dashboard_settings_dir: "{{ horizon_lib_dir }}/openstack_dashboard/local/local_settings.d" horizon_manage: "{{ horizon_bin }}/horizon-manage.py" _horizon_uwsgi_ini_requirements: diff --git a/vars/source_install.yml b/vars/source_install.yml index ee0cdddb..43f8fcb9 100644 --- a/vars/source_install.yml +++ b/vars/source_install.yml @@ -27,6 +27,8 @@ _horizon_bin: "/openstack/venvs/horizon-{{ horizon_venv_tag }}/bin" _dashboard_panels_location: - "/enabled" - "/conf" - - "/local_settings.d" - "/local/enabled" + +_dashboard_settings_location: + - "/local_settings.d" - "/local/local_settings.d"