From 9911c96791f4852457718e087814760cd9452d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20MOHIER?= Date: Sat, 28 Jan 2017 14:47:00 +0100 Subject: [PATCH] Fixes #715: search alignak.ini file relative to script launch directory --- dev/_launch_daemon.sh | 23 ++++++++++++++++++++++- test/test_retention.py | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/dev/_launch_daemon.sh b/dev/_launch_daemon.sh index 6d42c9890..c269807a1 100755 --- a/dev/_launch_daemon.sh +++ b/dev/_launch_daemon.sh @@ -99,6 +99,27 @@ case $i in esac done +# Alignak.ini file name +echo "---" +if [ ${ALIGNAKINI} ]; then + echo "Alignak ini configuration file is defined in the environment" + ALIGNAK_CONFIGURATION_INI="$ALIGNAKINI" +else + if [ -f "/usr/local/etc/alignak/alignak.ini" ]; then + echo "Alignak ini configuration file found in /usr/local/etc/alignak folder" + ALIGNAK_CONFIGURATION_INI="/usr/local/etc/alignak/alignak.ini" + else + if [ -f "/etc/alignak/alignak.ini" ]; then + echo "Alignak ini configuration file found in /etc/alignak folder" + ALIGNAK_CONFIGURATION_INI="/etc/alignak/alignak.ini" + else + ALIGNAK_CONFIGURATION_INI="$DIR/../etc/alignak.ini" + fi + fi +fi +echo "Alignak ini configuration file: $ALIGNAK_CONFIGURATION_INI" +echo "---" + # Get the daemon's variables names (only the name, not the value) scr_var="${DAEMON_NAME}_DAEMON" cfg_var="${DAEMON_NAME}_CFG" @@ -109,7 +130,7 @@ while IFS=';' read -ra VAR; do for v in "${VAR[@]}"; do eval "$v" done -done <<< "$($DIR/../alignak/bin/alignak_environment.py ../etc/alignak.ini)" +done <<< "$($DIR/../alignak/bin/alignak_environment.py $DIR/../etc/alignak.ini)" if [ ${ALIGNAKCFG} ]; then echo "Alignak main configuration file is defined in the environment" diff --git a/test/test_retention.py b/test/test_retention.py index 6d0c3b915..dbafbebac 100644 --- a/test/test_retention.py +++ b/test/test_retention.py @@ -171,4 +171,5 @@ def test_scheduler_retention(self): # acknowledge assert True == svcn.problem_has_been_acknowledged + assert False