From 35b92825b1cf428e7de121a217f9064668006f33 Mon Sep 17 00:00:00 2001
From: Michal Nasiadka <mnasiadka@gmail.com>
Date: Fri, 31 Mar 2023 14:02:33 +0200
Subject: [PATCH] cli: fix find globals.d

Currently when the /etc/kolla/globals.d directory does not exist
it writes an error on stderr.

Change-Id: I2d4b3dd9dde3d383af213dc6fd376bc14c650a7d
---
 tools/kolla-ansible | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kolla-ansible b/tools/kolla-ansible
index 3766db6171..9fce6e824f 100755
--- a/tools/kolla-ansible
+++ b/tools/kolla-ansible
@@ -567,7 +567,7 @@ EOF
 esac
 
 GLOBALS_DIR="${CONFIG_DIR}/globals.d"
-EXTRA_GLOBALS=$(find ${GLOBALS_DIR} -maxdepth 1 -type f -name '*.yml' -printf ' -e @%p' || true 2>/dev/null)
+EXTRA_GLOBALS=$([ -d "${GLOBALS_DIR}" ] && find ${GLOBALS_DIR} -maxdepth 1 -type f -name '*.yml' -printf ' -e @%p' || true 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 $CONFIG_OPTS $EXTRA_OPTS $PLAYBOOK $VERBOSITY"
-- 
GitLab