Update to 2.2.52 (#1849923)
Fixes for Python3.9 Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
This commit is contained in:
parent
7a7d2da99b
commit
fdaed20564
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,3 +10,5 @@
|
||||
/WALinuxAgent-2.2.40.tar.gz
|
||||
/WALinuxAgent-2.2.46.tar.gz
|
||||
/v2.2.48.1.tar.gz
|
||||
/WALinuxAgent-2.2.52.tar.gz
|
||||
/v2.2.52.tar.gz
|
||||
|
@ -0,0 +1,72 @@
|
||||
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
|
||||
|
90
0002-handle-py3.9-check-in-future.py.patch
Normal file
90
0002-handle-py3.9-check-in-future.py.patch
Normal file
@ -0,0 +1,90 @@
|
||||
From 66f600ed3d9f22c2aa6790002507d0c821a7fd0c Mon Sep 17 00:00:00 2001
|
||||
From: Paula Gombar <gombarica@gmail.com>
|
||||
Date: Tue, 8 Dec 2020 18:38:33 -0800
|
||||
Subject: [PATCH 2/3] handle py3.9 check in future.py
|
||||
|
||||
---
|
||||
azurelinuxagent/common/future.py | 13 ++++++++++++-
|
||||
azurelinuxagent/common/osutil/bigip.py | 8 +++-----
|
||||
azurelinuxagent/common/osutil/default.py | 9 ++-------
|
||||
3 files changed, 17 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/azurelinuxagent/common/future.py b/azurelinuxagent/common/future.py
|
||||
index 577fb12e186e..0f76aceba786 100644
|
||||
--- a/azurelinuxagent/common/future.py
|
||||
+++ b/azurelinuxagent/common/future.py
|
||||
@@ -103,4 +103,15 @@ def get_openwrt_platform():
|
||||
elif product_matches:
|
||||
if product_matches.group(1) == "OpenWrt":
|
||||
result[0] = "openwrt"
|
||||
- return result
|
||||
\ No newline at end of file
|
||||
+ return result
|
||||
+
|
||||
+
|
||||
+def array_to_string_or_bytes(buffer):
|
||||
+ # Python 3.9 removed the tostring() method on arrays, the new alias is tobytes()
|
||||
+ if sys.version_info[0] == 2:
|
||||
+ return buffer.tostring()
|
||||
+
|
||||
+ if sys.version_info[0] == 3 and sys.version_info[1] <= 8:
|
||||
+ return buffer.tostring()
|
||||
+
|
||||
+ return buffer.tobytes()
|
||||
diff --git a/azurelinuxagent/common/osutil/bigip.py b/azurelinuxagent/common/osutil/bigip.py
|
||||
index ceadf8ca2066..cc1b64143c12 100644
|
||||
--- a/azurelinuxagent/common/osutil/bigip.py
|
||||
+++ b/azurelinuxagent/common/osutil/bigip.py
|
||||
@@ -24,6 +24,8 @@ import socket
|
||||
import struct
|
||||
import time
|
||||
|
||||
+from azurelinuxagent.common.future import array_to_string_or_bytes
|
||||
+
|
||||
try:
|
||||
# WAAgent > 2.1.3
|
||||
import azurelinuxagent.common.logger as logger
|
||||
@@ -280,12 +282,8 @@ class BigIpOSUtil(DefaultOSUtil):
|
||||
if retsize == (expected * struct_size):
|
||||
logger.warn(('SIOCGIFCONF returned more than {0} up '
|
||||
'network interfaces.'), expected)
|
||||
- try:
|
||||
- # Python 3.9 removed the tostring() method on arrays, tobytes() is the new alias
|
||||
- sock = buff.tostring()
|
||||
- except AttributeError:
|
||||
- sock = buff.tobytes()
|
||||
|
||||
+ sock = array_to_string_or_bytes(buff)
|
||||
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 6179061756e3..c1ca15cf64ef 100644
|
||||
--- a/azurelinuxagent/common/osutil/default.py
|
||||
+++ b/azurelinuxagent/common/osutil/default.py
|
||||
@@ -41,7 +41,7 @@ import azurelinuxagent.common.utils.fileutil as fileutil
|
||||
import azurelinuxagent.common.utils.shellutil as shellutil
|
||||
import azurelinuxagent.common.utils.textutil as textutil
|
||||
from azurelinuxagent.common.exception import OSUtilError
|
||||
-from azurelinuxagent.common.future import ustr
|
||||
+from azurelinuxagent.common.future import ustr, array_to_string_or_bytes
|
||||
from azurelinuxagent.common.utils.cryptutil import CryptUtil
|
||||
from azurelinuxagent.common.utils.flexible_version import FlexibleVersion
|
||||
from azurelinuxagent.common.utils.networkutil import RouteEntry, NetworkInterfaceCard
|
||||
@@ -758,12 +758,7 @@ class DefaultOSUtil(object):
|
||||
logger.warn(('SIOCGIFCONF returned more than {0} up '
|
||||
'network interfaces.'), expected)
|
||||
|
||||
- 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()
|
||||
-
|
||||
+ ifconf_buff = array_to_string_or_bytes(buff)
|
||||
ifaces = {}
|
||||
for i in range(0, array_size, struct_size):
|
||||
iface = ifconf_buff[i:i+IFNAMSIZ].split(b'\0', 1)[0]
|
||||
--
|
||||
2.26.2
|
||||
|
33
0003-fix-pylint.patch
Normal file
33
0003-fix-pylint.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 90f1a4862cf63df4a96ad912effcfb54192ad4d7 Mon Sep 17 00:00:00 2001
|
||||
From: Paula Gombar <gombarica@gmail.com>
|
||||
Date: Tue, 8 Dec 2020 18:53:57 -0800
|
||||
Subject: [PATCH 3/3] fix pylint
|
||||
|
||||
---
|
||||
azurelinuxagent/common/future.py | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/azurelinuxagent/common/future.py b/azurelinuxagent/common/future.py
|
||||
index 0f76aceba786..a6796f19fec2 100644
|
||||
--- a/azurelinuxagent/common/future.py
|
||||
+++ b/azurelinuxagent/common/future.py
|
||||
@@ -106,12 +106,12 @@ def get_openwrt_platform():
|
||||
return result
|
||||
|
||||
|
||||
-def array_to_string_or_bytes(buffer):
|
||||
+def array_to_string_or_bytes(buff):
|
||||
# Python 3.9 removed the tostring() method on arrays, the new alias is tobytes()
|
||||
if sys.version_info[0] == 2:
|
||||
- return buffer.tostring()
|
||||
+ return buff.tostring()
|
||||
|
||||
if sys.version_info[0] == 3 and sys.version_info[1] <= 8:
|
||||
- return buffer.tostring()
|
||||
+ return buff.tostring()
|
||||
|
||||
- return buffer.tobytes()
|
||||
+ return buff.tobytes()
|
||||
--
|
||||
2.26.2
|
||||
|
@ -1,14 +1,19 @@
|
||||
%global with_legacy 0
|
||||
|
||||
Name: WALinuxAgent
|
||||
Version: 2.2.48.1
|
||||
Release: 2%{?dist}
|
||||
Version: 2.2.52
|
||||
Release: 1%{?dist}
|
||||
Summary: The Microsoft Azure Linux Agent
|
||||
|
||||
License: ASL 2.0
|
||||
URL: https://github.com/Azure/%{name}
|
||||
Source0: https://github.com/Azure/%{name}/archive/v%{version}.tar.gz
|
||||
|
||||
# Python3.9 fixes
|
||||
Patch0: 0001-update-array.tostring-and-json.loads-without-encodin.patch
|
||||
Patch1: 0002-handle-py3.9-check-in-future.py.patch
|
||||
Patch2: 0003-fix-pylint.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
BuildRequires: python3-devel
|
||||
@ -51,6 +56,9 @@ Udev rules specific to Microsoft Azure Virtual Machines.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
%build
|
||||
%py3_build
|
||||
@ -110,6 +118,10 @@ mv %{buildroot}%{_sysconfdir}/logrotate.d/waagent-extn.logrotate %{buildroot}%{_
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Dec 09 2020 Vitaly Kuznetsov <vkuznets@redhat.com> - 2.2.52-1
|
||||
- Update to 2.2.52 (#1849923)
|
||||
- Add not yet upstream patches supporting Python3.9 changes
|
||||
|
||||
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.48.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (v2.2.48.1.tar.gz) = 139c0b8d8696efdc570f44a63ee828d35ec162ee6a279ceba1a2b7d6ca4d6f99b7c428a4726286ca12b641c5957c3f1050b25a9d233e7a5bb559c8cef97bce0d
|
||||
SHA512 (v2.2.52.tar.gz) = b8d71cb4873b7e9cf92c755884bb104e5e37f171fbdae3d702b2b005a461b8f5447c9dcc80037ff0bfe9950ffbcb901e023e0bda918f481f5336c8ecbaecbbcc
|
||||
|
Loading…
Reference in New Issue
Block a user