1: Wait 5 seconds for ISMAS response.
2: For ISMAS response: check if device_id (=machine_nr) sent from ISMAS is the same as the local machine_nr. If NO, return 1 (fail).
This commit is contained in:
parent
fcf179bee1
commit
0e7f5938c7
@ -9,13 +9,27 @@ if [ "${news_from_ismas_sourced:-1}" = "1" ]; then # include only once
|
||||
updates_available () {
|
||||
local func="${FUNCNAME[0]}"
|
||||
local json_response="$((echo -n '#M=APISM #C=REQ_ISMASParameter #J={}';
|
||||
sleep 1) | nc localhost $APISM_DIRECT_PORT)"
|
||||
sleep 5) | nc localhost $APISM_DIRECT_PORT)"
|
||||
if [ $? -eq 0 ]; then
|
||||
local trigger="$(echo $json_response | jq -r .Fileupload.TRG)"
|
||||
log_debug "$func:${LINENO}: apism_trigger=\"$trigger\""
|
||||
grep -qE "WAIT" <<< "$trigger" && return 0
|
||||
local ismas_device_id="$(echo $json_response | jq -r .Dev_ID.Device_ID)"
|
||||
local machine_nr=$(cat "/etc/machine_nr")
|
||||
log_info "$func:${LINENO}: json_response=$json_response"
|
||||
log_info "$func:${LINENO}: apism_trigger=<$trigger> device_id=<$ismas_device_id> machine_nr=<$machine_nr>"
|
||||
if [ ! -z "$ismas_device_id" -a "$ismas_device_id" != " " ]; then
|
||||
if [ ! -z "$machine_nr" -a "$machine_nr" != " " ]; then
|
||||
if [ "$ismas_device_id" != "$machine_nr" ]; then
|
||||
log_error "$func:${LINENO}: ISMAS DEVICE ID <$ismas_deviceId> != LOCAL_MACHINE_NUMBER <$machine_nr>"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if grep -qE "WAIT" <<< "$trigger"; then
|
||||
log_info "$func:${LINENO}: FOUND WAIT TRIGGER"
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
log_error "$func:${LINENO}: apism request failed"
|
||||
log_error "$func:${LINENO}: APISM REQUEST FAILED"
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
@ -23,11 +37,11 @@ if [ "${news_from_ismas_sourced:-1}" = "1" ]; then # include only once
|
||||
update_status () {
|
||||
local func="${FUNCNAME[0]}"
|
||||
local json_response="$((echo -n '#M=APISM #C=REQ_ISMASParameter #J={}';
|
||||
sleep 1) | nc localhost $APISM_DIRECT_PORT)"
|
||||
sleep 5) | nc localhost $APISM_DIRECT_PORT)"
|
||||
local trigger=""
|
||||
if [ $? -eq 0 ]; then
|
||||
trigger="$(echo $json_response | jq -r .Fileupload.TRG)"
|
||||
log_debug "$func:${LINENO}: apism_trigger=\"$trigger\""
|
||||
log_info "$func:${LINENO}: apism_trigger=<$trigger>"
|
||||
else
|
||||
log_error "$func:${LINENO}: apism request failed"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user