Possible bug in 1.4.2-1 with running in detached mode

10 views
Skip to first unread message

John Sullivan

unread,
Jul 11, 2017, 2:29:21 PM7/11/17
to Warewulf-devel
In previous versions, the code did this:

    if [[ -n "$NHC_DETACHED" ]]; then
        echo "$RET $*" > $RESULTFILE


in 1.4.2-1:
        if [[ -w "$RESULTFILE" ]]; then
            echo "$RET $*" > $RESULTFILE
        else
            log "ERROR:  $NAME:  Unable to write to \"$RESULTFILE\" -- is ${RESULTFILE%/*} read-only?"
            syslog "ERROR:  $NAME:  Unable to write to \"$RESULTFILE\" -- is ${RESULTFILE%/*} read-only?"
            syslog_flush
        fi


The problem is the  if [[ -w "$RESULTFILE" ]]; then 

On my systems RESULTFILE doesn't exist by default. So this check fails every single time. If I modify 

        if [[ -w "$RESULTFILE" ]]; then
            echo "$RET $*" > $RESULTFILE
        else
            log "ERROR:  $NAME:  Unable to write to \"$RESULTFILE\" -- is ${RESULTFILE%/*} read-only?"
            syslog "ERROR:  $NAME:  Unable to write to \"$RESULTFILE\" -- is ${RESULTFILE%/*} read-only?"
            syslog_flush
        fi

to

        if [[ -w "/var/run/nhc" ]]; then
            echo "$RET $*" > $RESULTFILE
        else
            log "ERROR:  $NAME:  Unable to write to \"$RESULTFILE\" -- is ${RESULTFILE%/*} read-only?"
            syslog "ERROR:  $NAME:  Unable to write to \"$RESULTFILE\" -- is ${RESULTFILE%/*} read-only?"
            syslog_flush
        fi


Everything works as expected. I get the .status file and my NHC checks stop timing out. 

Let me know if you have any questions.

Thanks,
-Jay
Reply all
Reply to author
Forward
0 new messages