openstack-ansible-os_horizon/tasks/horizon_post_install_source.yml
Dmitriy Rabotyagov 3288a587f9 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
2024-09-24 15:11:58 +00:00

136 lines
4.1 KiB
YAML

---
# Copyright 2021, City Network International AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Create static horizon dir
file:
path: "{{ item.path }}"
state: "directory"
owner: "{{ item.owner | default(horizon_system_user_name) }}"
group: "{{ item.group | default(horizon_system_group_name) }}"
mode: "{{ item.mode | default('0755') }}"
with_items:
- { path: "{{ horizon_lib_dir }}/static", mode: "2755" }
- { path: "{{ horizon_lib_dir }}/openstack_dashboard", mode: "2755" }
- { path: "{{ horizon_lib_dir }}/openstack_dashboard/local", mode: "2755" }
- { path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled", mode: "2755" }
- name: Registering dashboards
find:
paths: "{{ horizon_lib_dir }}"
patterns: "^.*(dashboard|ui)$"
file_type: directory
use_regex: yes
excludes: "openstack_dashboard"
recurse: no
register: found_dashboards
- name: Registering panels
find:
paths: |-
{% set dashboard_path = [] %}
{% for dashboard in found_dashboards.files %}
{% for path in _dashboard_panels_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_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: |-
{% set policy_path = [] %}
{% for dashboard in found_dashboards.files %}
{% for path in _dashboard_panels_location %}
{% set _ = policy_path.append(dashboard.path + path + '/default_policies') %}
{% endfor %}
{% endfor %}
{{ policy_path }}
patterns: ['^.*\.(json|yaml)$']
file_type: file
use_regex: yes
register: found_default_policy
- name: Registering policy files
find:
paths: |-
{% set policy_path = [] %}
{% for dashboard in found_dashboards.files %}
{% for path in _dashboard_panels_location %}
{% set _ = policy_path.append(dashboard.path + path) %}
{% endfor %}
{% endfor %}
{{ policy_path }}
patterns: ["^.*_policy.(json|yaml)$"]
file_type: file
use_regex: yes
register: found_policy
- name: Link default policy files
file:
src: "{{ item.path }}"
dest: "{{ horizon_lib_dir }}/openstack_dashboard/conf/default_policies/{{ item.path | basename }}"
state: link
with_items: "{{ found_default_policy.files }}"
notify:
- Compile messages
- name: Link policy files
file:
src: "{{ item.path }}"
dest: "{{ horizon_lib_dir }}/openstack_dashboard/conf/{{ item.path | basename }}"
state: link
with_items: "{{ found_policy.files }}"
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 }}"
path: "{{ horizon_dashboard_panel_dir }}/{{ item.path | basename }}"
state: link
with_items: "{{ found_panels.files }}"
notify:
- Compile messages
- Restart wsgi process