From 4435960f4a26a87ded6c52732219ddb00d0d6e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=E1=B4=8F=C9=B4=C9=A2=20Jie?= Date: Wed, 20 Mar 2019 18:06:15 +0800 Subject: [PATCH] Fix python error, TypeError: cannot use a string pattern on a bytes-like object (#6137) --- xCAT-server/share/xcat/install/scripts/pre.rhels8 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/pre.rhels8 b/xCAT-server/share/xcat/install/scripts/pre.rhels8 index b95582e51..4563e2632 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.rhels8 +++ b/xCAT-server/share/xcat/install/scripts/pre.rhels8 @@ -77,7 +77,7 @@ try: received = newSocket.recv(200) if not received: break - command = re.split('\s+',received) + command = re.split(b'\s+',received) if(command[0] == b"stat"): ilog = "" line = "" @@ -113,10 +113,10 @@ try: newSocket.send(line.encode()) break #UNCOMMENTOENABLEDEBUGPORT# if(command[0] == b"sh"): #DEBUG purposes only, wide open root priv command here. -#UNCOMMENTOENABLEDEBUGPORT# newcommand = "" +#UNCOMMENTOENABLEDEBUGPORT# newcommand = b"" #UNCOMMENTOENABLEDEBUGPORT# for i in command[1:]: -#UNCOMMENTOENABLEDEBUGPORT# newcommand = newcommand + i + " " -#UNCOMMENTOENABLEDEBUGPORT# output = os.popen(newcommand).read() +#UNCOMMENTOENABLEDEBUGPORT# newcommand = newcommand + i + b" " +#UNCOMMENTOENABLEDEBUGPORT# output = os.popen(newcommand.decode('utf-8')).read() #UNCOMMENTOENABLEDEBUGPORT# newSocket.send(output.encode()) #UNCOMMENTOENABLEDEBUGPORT# break if(command[0] == b"screendump"):