icinga2-{disable,enable}-feature should check if "ln" worked.

Fixes #5753
This commit is contained in:
Michael Friedrich 2014-03-17 18:44:06 +01:00
parent 67782607eb
commit 1408c26e5c
1 changed files with 12 additions and 6 deletions

View File

@ -49,18 +49,24 @@ if [ "$TOOL" = "icinga2-enable-feature" ]; then
exit 0 exit 0
fi fi
ln -s ../features-available/$FEATURE.conf $ICINGA2CONFDIR/features-enabled/ if ! ln -s ../features-available/$FEATURE.conf $ICINGA2CONFDIR/features-enabled/; then
echo "Enabling '$FEATURE' failed. Check permissions for $ICINGA2CONFDIR/features-enabled/"
echo "Module '$FEATURE' was enabled." exit 1
else
echo "Module '$FEATURE' was enabled."
fi
elif [ "$TOOL" = "icinga2-disable-feature" ]; then elif [ "$TOOL" = "icinga2-disable-feature" ]; then
if [ ! -e $ICINGA2CONFDIR/features-enabled/$FEATURE.conf ]; then if [ ! -e $ICINGA2CONFDIR/features-enabled/$FEATURE.conf ]; then
echo "The feature '$FEATURE' is already disabled." echo "The feature '$FEATURE' is already disabled."
exit 0 exit 0
fi fi
rm -f $ICINGA2CONFDIR/features-enabled/$FEATURE.conf if ! rm -f $ICINGA2CONFDIR/features-enabled/$FEATURE.conf; then
echo "Disabling '$FEATURE' failed. Check permissions for $ICINGA2CONFDIR/features-enabled/$FEATURE.conf"
echo "Module '$FEATURE' was disabled." exit 1
else
echo "Module '$FEATURE' was disabled."
fi
fi fi
echo "Make sure to restart Icinga 2 for these changes to take effect." echo "Make sure to restart Icinga 2 for these changes to take effect."