Skip to content

Commit

Permalink
Debian: Fix sw-manager commands
Browse files Browse the repository at this point in the history
sw-manager strategy creation commands trigger
a python3 error.  The issue is that python2 supports
a string, but python3 expects bytes.

The fix is to send the appropriate message
based on the whether we are in python2 or python3.

Test Plan:
  Debian:  verify sw-manager patch-strategy create works
  Centos:  verify sw-manager patch-strategy create works

Closes-Bug: 1974475
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I94800fa870f1a444df6e95ba2f206803a4acfc18
  • Loading branch information
albailey-wr committed May 20, 2022
1 parent 985739f commit 3e6c2d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nfv/nfv-common/nfv_common/schedule/_schedule_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: Apache-2.0
#
import six
import socket

from nfv_common import selobj
Expand All @@ -13,6 +14,12 @@
_receive_socket = None
_pending_function_calls = list()

if six.PY3:
# python3 requires the string be converted to bytes
MESSAGE_ONE = '1'.encode('utf-8')
else:
MESSAGE_ONE = '1'


def schedule_function_call(func, *args, **kwargs):
"""
Expand All @@ -22,7 +29,7 @@ def schedule_function_call(func, *args, **kwargs):

function_data = (func, args, kwargs)
_pending_function_calls.append(function_data)
_send_socket.send('1')
_send_socket.send(MESSAGE_ONE)


@coroutine
Expand Down

0 comments on commit 3e6c2d4

Please sign in to comment.