Skip to content

Commit

Permalink
Fixes #715: search alignak.ini file relative to script launch directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mohierf committed Jan 28, 2017
1 parent 6d3db6b commit 9911c96
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
23 changes: 22 additions & 1 deletion dev/_launch_daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions test/test_retention.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,5 @@ def test_scheduler_retention(self):

# acknowledge
assert True == svcn.problem_has_been_acknowledged
assert False

0 comments on commit 9911c96

Please sign in to comment.