Question regarding Git config management

Sebastian Hagedorn Hagedorn at uni-koeln.de
Thu May 28 17:13:26 CEST 2015


--On 27. Mai 2015 11:25:52 -0400 Alan DeKok <aland at deployingradius.com> 
wrote:

>> The "radmin -e hup" command did not throw an error. Consequently the
>> commit was tagged as "stable". When I tried to manually restart
>> Freeradius on the remote server, it didn't start anymore (as expected).
>> At that point I wasn't even able to push a fix, because radmin doesn't
>> work when the server isn't running, and so the post-receive hook
>> reverted back to the "stable" version! I had to fix the error manually
>> on the remote server to get things working again.
>
>   That's a bit of a different issue.  If the server isn't running, then
> you should be able to push updates.  Please send a patch.

For that particular problem I have come up with this, which seems to work:

--- post-receive.orig	2015-05-28 17:09:53.191609956 +0200
+++ post-receive	2015-05-28 17:07:36.175731010 +0200
@@ -15,11 +15,14 @@
 # Descriptive name of daemon
 : ${DAEMON_DESC='FreeRADIUS'}

+# Init script for radiusd
+: ${DAEMON_STATUS='/etc/init.d/radiusd status'}
+
 # Command used to restart the RADIUS daemon
-: ${DAEMON_REST='radmin -e hup'}
+: ${DAEMON_REST='/usr/sbin/radmin -e hup'}

 # Command used to verify the new configuration
-: ${DAEMON_CONF='radiusd -Cxl stdout'}
+: ${DAEMON_CONF='/usr/sbin/radiusd -Cxl stdout'}

 # Command used to execute git functions
 : ${GIT_EXEC='env -i git'}
@@ -65,6 +68,13 @@
 	return $ret
 }

+daemon_status () {
+	echo -n "Checking if radiusd is running ... "
+	$DAEMON_STATUS; ret=$?
+
+	return $ret
+}
+
 daemon_restart () {
 	echo -n "Restarting server... "

@@ -113,18 +123,22 @@
 	conf_rollback
 	exit 64
 else
-	if ! daemon_restart; then
-		if ! conf_rollback; then
-			echo "WARNING: Manually verify $DAEMON_DESC status immediately!"
-			exit 64
-		fi
-
+	if daemon_status; then
 		if ! daemon_restart; then
-			echo "WARNING: Manually verify $DAEMON_DESC status immediately!"
+			if ! conf_rollback; then
+				echo "WARNING: Manually verify $DAEMON_DESC status immediately!"
+				exit 64
+			fi
+
+			if ! daemon_restart; then
+				echo "WARNING: Manually verify $DAEMON_DESC status immediately!"
+				exit 64
+			fi
+
 			exit 64
 		fi
-
-		exit 64
+	else
+		echo "radiusd isn't running, please verify manually"
 	fi

 	$GIT_EXEC tag -f $STABLE_TAG $newrev

Sebastian Hagedorn
-- 
    .:.Sebastian Hagedorn - Weyertal 121 (Gebäude 133), Zimmer 2.02.:.
                 .:.Regionales Rechenzentrum (RRZK).:.
   .:.Universität zu Köln / Cologne University - ✆ +49-221-470-89578.:.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pkcs7-signature
Size: 5313 bytes
Desc: not available
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20150528/68c9c254/attachment.bin>


More information about the Freeradius-Users mailing list