Blame SOURCES/bz1748443-fence_zvmip-python3-fixes.patch

21d5fd
From 2735a4ee096f87fda2e94029db7f059d7be28464 Mon Sep 17 00:00:00 2001
21d5fd
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
21d5fd
Date: Thu, 5 Sep 2019 10:28:18 +0200
21d5fd
Subject: [PATCH] fence_zvmip: fix Python 3 issues
21d5fd
21d5fd
---
21d5fd
 agents/zvm/fence_zvmip.py | 8 ++++----
21d5fd
 1 file changed, 4 insertions(+), 4 deletions(-)
21d5fd
21d5fd
diff --git a/agents/zvm/fence_zvmip.py b/agents/zvm/fence_zvmip.py
21d5fd
index 5fbe53e4..e6bb01d1 100644
21d5fd
--- a/agents/zvm/fence_zvmip.py
21d5fd
+++ b/agents/zvm/fence_zvmip.py
21d5fd
@@ -37,7 +37,7 @@ def open_socket(options):
21d5fd
 	return conn
21d5fd
 
21d5fd
 def smapi_pack_string(string):
21d5fd
-	return struct.pack("!i%ds" % (len(string)), len(string), string)
21d5fd
+	return struct.pack("!i%ds" % (len(string)), len(string), string.encode("UTF-8"))
21d5fd
 
21d5fd
 def prepare_smapi_command(options, smapi_function, additional_args):
21d5fd
 	packet_size = 3*INT4 + len(smapi_function) + len(options["--username"]) + len(options["--password"])
21d5fd
@@ -126,7 +126,7 @@ def get_list_of_images(options, command, data_as_plug):
21d5fd
 		data = ""
21d5fd
 
21d5fd
 		while True:
21d5fd
-			read_data = conn.recv(1024, socket.MSG_WAITALL)
21d5fd
+			read_data = conn.recv(1024, socket.MSG_WAITALL).decode("UTF-8")
21d5fd
 			data += read_data
21d5fd
 			if array_len == len(data):
21d5fd
 				break
21d5fd
@@ -136,9 +136,9 @@ def get_list_of_images(options, command, data_as_plug):
21d5fd
 
21d5fd
 		parsed_len = 0
21d5fd
 		while parsed_len < array_len:
21d5fd
-			string_len = struct.unpack("!i", data[parsed_len:parsed_len+INT4])[0]
21d5fd
+			string_len = struct.unpack("!i", data[parsed_len:parsed_len+INT4].encode("UTF-8"))[0]
21d5fd
 			parsed_len += INT4
21d5fd
-			image_name = struct.unpack("!%ds" % (string_len), data[parsed_len:parsed_len+string_len])[0]
21d5fd
+			image_name = struct.unpack("!%ds" % (string_len), data[parsed_len:parsed_len+string_len].encode("UTF-8"))[0].decode("UTF-8")
21d5fd
 			parsed_len += string_len
21d5fd
 			images.add(image_name)
21d5fd