py3: Fix sm-api communication

mtcAgent get response code 500 from sm-api.

Tests on AIO-DX:
CentOS:
PASS: unlocked enabled available controller-1
Debian:
integration not far enough to test controller-1 unlock
PASS: mtcAgent gets a proper response from sm-api

Story: 2009968
Task: 45504
Closes-Bug: 1976515
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: I5912f8d506d220775e2346f4b8771758cf818e3c
This commit is contained in:
Dan Voiculeasa 2022-05-31 16:14:06 +03:00 committed by Dan Voiculeasa
parent d4ea342b10
commit 924c088f3a
1 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2014-2018 Wind River Systems, Inc.
# Copyright (c) 2014-2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
@ -77,12 +77,12 @@ def sm_api_notify(sm_dict):
s.setblocking(1) # blocking, timeout must be specified
s.settimeout(6) # give sm a few secs to respond
s.bind(SM_API_CLIENT_ADDR)
s.sendto(sm_buf, SM_API_SERVER_ADDR)
s.sendto(sm_buf.encode('ascii', 'ignore'), SM_API_SERVER_ADDR)
count = 0
while count < 5:
count += 1
sm_ack = s.recv(1024)
sm_ack = s.recv(1024).decode('ascii')
try:
sm_ack_list = sm_ack.split(",")