From bf985930d01abffcb0de7f2e855d559ab56efd93 Mon Sep 17 00:00:00 2001
From: Michal Nasiadka <mnasiadka@gmail.com>
Date: Wed, 8 Jul 2020 12:08:23 +0200
Subject: [PATCH] Evaluate PASSWORDS_FILE later
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently seting --configdir on kolla-ansible CLI doesn't set properly the path
for the passwords file.

Change-Id: I38d215b721ec256be6cfdd6313b5ffb90c2a3f4c
Closes-Bug: #1887180
Co-Authored-By: Radosław Piliszek <radoslaw.piliszek@gmail.com>
---
 releasenotes/notes/bug-1887180-89450a4185c7449d.yaml | 6 ++++++
 tools/kolla-ansible                                  | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 releasenotes/notes/bug-1887180-89450a4185c7449d.yaml

diff --git a/releasenotes/notes/bug-1887180-89450a4185c7449d.yaml b/releasenotes/notes/bug-1887180-89450a4185c7449d.yaml
new file mode 100644
index 0000000000..ec312c7996
--- /dev/null
+++ b/releasenotes/notes/bug-1887180-89450a4185c7449d.yaml
@@ -0,0 +1,6 @@
+---
+fixes:
+  - |
+    Fixes ``--configdir`` parameter to apply to default ``passwords.yml``
+    location.
+    `LP#1887180 <https://launchpad.net/bugs/1887180>`__
diff --git a/tools/kolla-ansible b/tools/kolla-ansible
index 8221c15cb0..2fea170b5a 100755
--- a/tools/kolla-ansible
+++ b/tools/kolla-ansible
@@ -198,7 +198,6 @@ PLAYBOOK="${BASEDIR}/ansible/site.yml"
 VERBOSITY=
 EXTRA_OPTS=${EXTRA_OPTS}
 CONFIG_DIR="/etc/kolla"
-PASSWORDS_FILE="${CONFIG_DIR}/passwords.yml"
 DANGER_CONFIRM=
 INCLUDE_IMAGES=
 INCLUDE_DEV=
@@ -454,6 +453,7 @@ esac
 
 GLOBALS_DIR="${CONFIG_DIR}/globals.d"
 EXTRA_GLOBALS=$(find ${GLOBALS_DIR} -maxdepth 1 -type f -name '*.yml' -printf ' -e @%p' 2>/dev/null)
+PASSWORDS_FILE="${PASSWORDS_FILE:-${CONFIG_DIR}/passwords.yml}"
 CONFIG_OPTS="-e @${CONFIG_DIR}/globals.yml ${EXTRA_GLOBALS} -e @${PASSWORDS_FILE} -e CONFIG_DIR=${CONFIG_DIR}"
 CMD="ansible-playbook -i $INVENTORY $CONFIG_OPTS $EXTRA_OPTS $PLAYBOOK $VERBOSITY"
 process_cmd