ESA Notification script broken in version 10.6.6.1

Document created by Alejandro Negron Employee on Oct 12, 2019Last modified by Alejandro Negron Employee on Oct 12, 2019
Version 3Show Document
  • View in full screen mode

If you use notification scripts as part of your ESA rules and recently migrated to version 10.6.6.1 you may have noticed that the output notification "script" is not working any more but no worries, the solution to this problem is pretty simple.  

 

The problem is related to a new version of the wrapper.sh located in the ESA in /opt/rsa/esa/scripts/ 

 

This is how the wrapper.sh looks like after you migrate to 10.6.6.1:

 

LEAST_REQUIRED_ARGS=2

if [ $# -ge $LEAST_REQUIRED_ARGS ]
then
    RUN_AS_USER=$1
    SCRIPT_FILE=$2
    shift $LEAST_REQUIRED_ARGS
   
    if [ -f "$SCRIPT_FILE" -a -x "$SCRIPT_FILE" ]
    then
        echo $* > /opt/rsa/esa/scripts/temp.json
        data = $(< /opt/rsa/esa/scripts/temp.json)
        #sed -i 's/`/ /g' $data
        rm -rf /opt/rsa/esa/scripts/temp.json
        /bin/su - $RUN_AS_USER -c "$SCRIPT_FILE \"$data\""

    fi
fi

 

Pay attention to line 12 where the definition of the data variable is, as you can see there are two white spaces, one before and one after the = sign, those spaces should not be there because in variable assignments Bash will interpret them as arguments so all you need to do is remove those spaces and leave it like this:

 

LEAST_REQUIRED_ARGS=2

if [ $# -ge $LEAST_REQUIRED_ARGS ]
then
    RUN_AS_USER=$1
    SCRIPT_FILE=$2
    shift $LEAST_REQUIRED_ARGS
   
    if [ -f "$SCRIPT_FILE" -a -x "$SCRIPT_FILE" ]
    then
        echo $* > /opt/rsa/esa/scripts/temp.json
        data=$(< /opt/rsa/esa/scripts/temp.json)
        #sed -i 's/`/ /g' $data
        rm -rf /opt/rsa/esa/scripts/temp.json
        /bin/su - $RUN_AS_USER -c "$SCRIPT_FILE \"$data\""

    fi
fi

 

That´s it, your script notifications should be working again.

 

Alejandro Negrón

2 people found this helpful

Attachments

    Outcomes