tags 625555 + patch
thanks

Looking a bit further into this made me recognize this:

* integer comparison is used on ${SLAVE_ENABLED[$i]}, but since the user
may enter any value in /etc/default/buildslave the assumption that this
is an integer is wrong and the comment "0-enabled, other-disabled"
explicitly asks for disabling a slave by using values like "yes",
"true", "1", "", ...

* a disabled entry is treated as a syntax error


My attached patch changes the following:
- use string comparison to detect disabled entries
- skip syntax check on disabled entries

I would gladly provide a patch that switches the ENABLED value to 1,
since 0 is a very weird integer value for TRUE)


Andreas
--- /etc/init.d/buildslave~dist 2011-05-01 21:32:46.000000000 +0200
+++ /etc/init.d/buildslave      2011-05-04 14:39:18.000000000 +0200
@@ -49,6 +49,8 @@
 
     errors=0
     for i in $( seq ${#SLAVE_ENABLED[@]} ); do
+        [[ "${SLAVE_ENABLED[$i]}" != "0" ]] && continue
+
         if [[ ${SLAVE_ENABLED[$i]} -ne 0 ]]; then 
             log_failure_msg "buildslave #${i}: unknown run status"
             errors=$(($errors+1))
@@ -93,7 +95,7 @@
 function do_op () {
     errors=0
     for i in $( seq ${#SLAVE_ENABLED[@]} ); do
-        [[ ${SLAVE_ENABLED[$i]} -ne 0 ]] && continue
+        [[ "${SLAVE_ENABLED[$i]}" != "0" ]] && continue
 
         # Some rhels don't come with all the lsb goodies
         if iscallable log_daemon_msg; then

Reply via email to