0e82e6381b
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/WALinuxAgent.git#fdaed2056491f5835cfbe06620333c3694eb6833
73 lines
2.7 KiB
Diff
73 lines
2.7 KiB
Diff
From cc9b7996e542640bb19365822344298a04b18e44 Mon Sep 17 00:00:00 2001
|
|
From: Paula Gombar <gombarica@gmail.com>
|
|
Date: Wed, 18 Nov 2020 12:24:33 -0800
|
|
Subject: [PATCH 1/3] update array.tostring() and json.loads without encoding
|
|
for py3.9
|
|
|
|
---
|
|
azurelinuxagent/common/osutil/bigip.py | 7 ++++++-
|
|
azurelinuxagent/common/osutil/default.py | 6 +++++-
|
|
tests/protocol/test_imds.py | 4 ++--
|
|
3 files changed, 13 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/azurelinuxagent/common/osutil/bigip.py b/azurelinuxagent/common/osutil/bigip.py
|
|
index 61d3c695f911..ceadf8ca2066 100644
|
|
--- a/azurelinuxagent/common/osutil/bigip.py
|
|
+++ b/azurelinuxagent/common/osutil/bigip.py
|
|
@@ -280,7 +280,12 @@ class BigIpOSUtil(DefaultOSUtil):
|
|
if retsize == (expected * struct_size):
|
|
logger.warn(('SIOCGIFCONF returned more than {0} up '
|
|
'network interfaces.'), expected)
|
|
- sock = buff.tostring()
|
|
+ try:
|
|
+ # Python 3.9 removed the tostring() method on arrays, tobytes() is the new alias
|
|
+ sock = buff.tostring()
|
|
+ except AttributeError:
|
|
+ sock = buff.tobytes()
|
|
+
|
|
for i in range(0, struct_size * expected, struct_size):
|
|
iface = self._format_single_interface_name(sock, i)
|
|
|
|
diff --git a/azurelinuxagent/common/osutil/default.py b/azurelinuxagent/common/osutil/default.py
|
|
index 521776818e64..6179061756e3 100644
|
|
--- a/azurelinuxagent/common/osutil/default.py
|
|
+++ b/azurelinuxagent/common/osutil/default.py
|
|
@@ -758,7 +758,11 @@ class DefaultOSUtil(object):
|
|
logger.warn(('SIOCGIFCONF returned more than {0} up '
|
|
'network interfaces.'), expected)
|
|
|
|
- ifconf_buff = buff.tostring()
|
|
+ try:
|
|
+ # Python 3.9 removed the tostring() method on arrays, tobytes() is the new alias
|
|
+ ifconf_buff = buff.tostring()
|
|
+ except AttributeError:
|
|
+ ifconf_buff = buff.tobytes()
|
|
|
|
ifaces = {}
|
|
for i in range(0, array_size, struct_size):
|
|
diff --git a/tests/protocol/test_imds.py b/tests/protocol/test_imds.py
|
|
index a730ded03525..47462fd25ac3 100644
|
|
--- a/tests/protocol/test_imds.py
|
|
+++ b/tests/protocol/test_imds.py
|
|
@@ -109,7 +109,7 @@ class TestImds(AgentTestCase):
|
|
"zone": "In"
|
|
}'''
|
|
|
|
- data = json.loads(s, encoding='utf-8')
|
|
+ data = json.loads(s)
|
|
|
|
compute_info = imds.ComputeInfo()
|
|
set_properties("compute", compute_info, data)
|
|
@@ -258,7 +258,7 @@ class TestImds(AgentTestCase):
|
|
"version": "{3}"
|
|
}}'''.format(publisher, offer, sku, version)
|
|
|
|
- data = json.loads(s, encoding='utf-8')
|
|
+ data = json.loads(s)
|
|
compute_info = imds.ComputeInfo()
|
|
set_properties("compute", compute_info, data)
|
|
|
|
--
|
|
2.26.2
|
|
|