]> granicus.if.org Git - icinga2/commitdiff
icinga2-{disable,enable}-feature should check if "ln" worked.
authorMichael Friedrich <michael.friedrich@netways.de>
Mon, 17 Mar 2014 17:44:06 +0000 (18:44 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Mon, 17 Mar 2014 17:44:06 +0000 (18:44 +0100)
Fixes #5753

tools/icinga2-enable-feature.cmake

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