From c4a61ca3c873913776fb448d15fe931c79520db1 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 11 Oct 2019 15:17:20 -0400 Subject: [PATCH] Fix SR635/SR655 firmware updates in python3 Accomodate python 2 and 3 names for urlencode and consistently use binary bytes in processing the hpm contents. Change-Id: Id733e09c317135a04526e307d850d7c6bc399955 --- pyghmi/redfish/oem/lenovo/tsma.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pyghmi/redfish/oem/lenovo/tsma.py b/pyghmi/redfish/oem/lenovo/tsma.py index e3603ab7..b1d4150f 100644 --- a/pyghmi/redfish/oem/lenovo/tsma.py +++ b/pyghmi/redfish/oem/lenovo/tsma.py @@ -19,7 +19,10 @@ import pyghmi.exceptions as exc import pyghmi.util.webclient as webclient import struct import time -import urllib +try: + from urllib import urlencode +except ImportError: + from urllib.parse import urlencode import weakref hpm_by_filename = {} @@ -40,7 +43,7 @@ def read_hpm(filename): hpmfile.seek(1, 1) major, minor, pat = struct.unpack('= 300: raise Exception('Error establishing web session') self.csrftok = rsp['CSRFToken']