From 35e0d76a96fbcbc08f600294ca7daac6288df1d5 Mon Sep 17 00:00:00 2001
From: Jakub Darmach <jakub@stackhpc.com>
Date: Thu, 13 Jan 2022 14:24:52 +0100
Subject: [PATCH] Support for untemplated dirs in kolla config

Variable untemplated_dirs has been added to allow for
defining directories under kayobe/kolla/config which should be copied
instead of templated by kolla-openstack role.

This is needed to support custom themes for horizon -
change If9982c8e18be31772cb031ef72b7eebd4d768be5

Change-Id: I350f58c8a82f0f31608b34054e804c5c198d6806
---
 ansible/roles/kolla-openstack/tasks/config.yml                | 4 +++-
 ansible/roles/kolla-openstack/vars/main.yml                   | 3 +++
 ...dd-support-for-custom-horizon-themes-5da1d99c1b8107b9.yaml | 3 +++
 3 files changed, 9 insertions(+), 1 deletion(-)
 create mode 100644 releasenotes/notes/add-support-for-custom-horizon-themes-5da1d99c1b8107b9.yaml

diff --git a/ansible/roles/kolla-openstack/tasks/config.yml b/ansible/roles/kolla-openstack/tasks/config.yml
index b13a4709..5123bcda 100644
--- a/ansible/roles/kolla-openstack/tasks/config.yml
+++ b/ansible/roles/kolla-openstack/tasks/config.yml
@@ -115,6 +115,7 @@
     - item.0.item.enabled | bool
     - item.1.path | basename not in item.0.item.ignore | default([])
     - item.1.path | basename not in item.0.item.untemplated | default([])
+    - (item.1.path | dirname | relpath(item.0.item.src)).split("/")[0] not in item.0.item.untemplated_dirs | default([])
 
 - name: Ensure untemplated extra configuration files exist
   copy:
@@ -128,7 +129,8 @@
   when:
     - item.0.item.enabled | bool
     - item.1.path | basename not in item.0.item.ignore | default([])
-    - item.1.path | basename in item.0.item.untemplated | default([])
+    - (item.1.path | basename in item.0.item.untemplated | default([])) or
+      ((item.1.path | dirname | relpath(item.0.item.src)).split("/")[0] in item.0.item.untemplated_dirs | default([]))
 
 - name: Ensure unnecessary extra configuration files are absent
   file:
diff --git a/ansible/roles/kolla-openstack/vars/main.yml b/ansible/roles/kolla-openstack/vars/main.yml
index 5a53c844..e7252a13 100644
--- a/ansible/roles/kolla-openstack/vars/main.yml
+++ b/ansible/roles/kolla-openstack/vars/main.yml
@@ -98,6 +98,9 @@ kolla_openstack_custom_config:
     dest: "{{ kolla_node_custom_config_path }}/horizon"
     patterns: "*"
     enabled: "{{ kolla_enable_horizon }}"
+    untemplated_dirs:
+    # Do not attempt to template themes directory.
+      - "themes"
   # InfluxDB.
   - src: "{{ kolla_extra_config_path }}/"
     dest: "{{ kolla_node_custom_config_path }}/"
diff --git a/releasenotes/notes/add-support-for-custom-horizon-themes-5da1d99c1b8107b9.yaml b/releasenotes/notes/add-support-for-custom-horizon-themes-5da1d99c1b8107b9.yaml
new file mode 100644
index 00000000..a422a837
--- /dev/null
+++ b/releasenotes/notes/add-support-for-custom-horizon-themes-5da1d99c1b8107b9.yaml
@@ -0,0 +1,3 @@
+---
+features:
+  - Adds support for custom Horizon themes.
-- 
GitLab