From 786a78d074a4451cf2774b2e8e4c0808816beff2 Mon Sep 17 00:00:00 2001
From: Will Szumski <will@stackhpc.com>
Date: Fri, 17 Nov 2023 18:56:23 +0000
Subject: [PATCH] Deduplicate before picking merge strategy

I missed this when I refactored the code to fallback
to templating. We need to deduplicate before picking
the strategy for the fallback to work for symlinked files.

Change-Id: Iddd6c90a6daa41e1d1cdaa6b598491792c13394d
Closes-Bug: #2042689
---
 .../action_plugins/kolla_custom_config_info.py              | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ansible/roles/kolla-openstack/action_plugins/kolla_custom_config_info.py b/ansible/roles/kolla-openstack/action_plugins/kolla_custom_config_info.py
index 13b8b26cd..d2ee3b6ae 100644
--- a/ansible/roles/kolla-openstack/action_plugins/kolla_custom_config_info.py
+++ b/ansible/roles/kolla-openstack/action_plugins/kolla_custom_config_info.py
@@ -128,14 +128,14 @@ class ConfigCollector(object):
             if not os.path.exists(dirname):
                 missing_directories.add(dirname)
 
+            sources = map(os.path.realpath, sources)
+            sources = _dedup(sources)
+
             rule = self._find_matching_rule(relative_path, sources)
 
             if not rule:
                 continue
 
-            sources = map(os.path.realpath, sources)
-            sources = _dedup(sources)
-
             if rule["strategy"] == 'copy':
                 copy = {
                     "src": sources[-1],