Sync from SUSE:SLFO:Main python-azure-agent revision a70075a31ac7f9333532fc8eb75e16ac

This commit is contained in:
Adrian Schröter 2025-02-20 10:01:42 +01:00
parent e7d5f66606
commit dd6a2cd3b9
10 changed files with 261 additions and 204 deletions

BIN
WALinuxAgent-2.12.0.4.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
WALinuxAgent-2.9.1.1.tar.gz (Stored with Git LFS)

Binary file not shown.

View File

@ -1,11 +0,0 @@
--- azurelinuxagent/common/osutil/factory.py.orig
+++ azurelinuxagent/common/osutil/factory.py
@@ -90,7 +90,7 @@ def _get_osutil(distro_name, distro_code
if distro_name in ("flatcar", "coreos") or distro_code_name in ("flatcar", "coreos"):
return CoreOSUtil()
- if distro_name in ("suse", "sle_hpc", "sles", "opensuse"):
+ if distro_name in ("suse", "sle-micro", "sle_hpc", "sles", "opensuse"):
if distro_full_name == 'SUSE Linux Enterprise Server' \
and Version(distro_version) < Version('12') \
or distro_full_name == 'openSUSE' and Version(distro_version) < Version('13.2'):

View File

@ -1,11 +0,0 @@
--- config/suse/waagent.conf.orig
+++ config/suse/waagent.conf
@@ -109,7 +109,7 @@ OS.SshDir=/etc/ssh
# OS.CheckRdmaDriver=y
# Enable or disable goal state processing auto-update, default is enabled
-# AutoUpdate.Enabled=y
+AutoUpdate.Enabled=n
# Determine the update family, this should not be changed
# AutoUpdate.GAFamily=Prod

View File

@ -1,16 +1,18 @@
--- azurelinuxagent/pa/rdma/suse.py.orig
+++ azurelinuxagent/pa/rdma/suse.py
Index: WALinuxAgent-2.12.0.4/azurelinuxagent/pa/rdma/suse.py
===================================================================
--- WALinuxAgent-2.12.0.4.orig/azurelinuxagent/pa/rdma/suse.py
+++ WALinuxAgent-2.12.0.4/azurelinuxagent/pa/rdma/suse.py
@@ -31,8 +31,17 @@ class SUSERDMAHandler(RDMAHandler):
def install_driver(self): # pylint: disable=R1710
"""Install the appropriate driver package for the RDMA firmware"""
+ suport_pci_passthrough = False
+ if Version(DISTRO_VERSION) == Version('12'):
+ if DistroVersion(DISTRO_VERSION) == DistroVersion('12'):
+ release_data = open('/etc/os-release').read()
+ if 'SP5' in release_data:
+ suport_pci_passthrough = True
+
if Version(DISTRO_VERSION) >= Version('15'):
if DistroVersion(DISTRO_VERSION) >= DistroVersion('15'):
- msg = 'SLE 15 and later only supports PCI pass through, no '
+ suport_pci_passthrough = True
+

View File

@ -0,0 +1,12 @@
--- init/waagent.service.orig
+++ init/waagent.service
@@ -8,7 +8,8 @@ ConditionPathExists=/etc/waagent.conf
[Service]
Type=simple
-ExecStart=/usr/bin/python -u /usr/sbin/waagent -daemon
+Environment="PYTHONUNBUFFERED=true"
+ExecStart=/usr/sbin/waagent -daemon
Restart=always
RestartSec=5

View File

@ -1,19 +0,0 @@
--- bin/waagent.orig
+++ bin/waagent
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
#
# Azure Linux Agent
#
--- init/waagent.service.orig
+++ init/waagent.service
@@ -8,7 +8,7 @@ ConditionPathExists=/etc/waagent.conf
[Service]
Type=simple
-ExecStart=/usr/bin/python -u /usr/sbin/waagent -daemon
+ExecStart=/usr/bin/python3 -u /usr/sbin/waagent -daemon
Restart=always
RestartSec=5

View File

@ -1,3 +1,142 @@
-------------------------------------------------------------------
Mon Dec 23 10:54:55 UTC 2024 - Robert Schweikert <rjschwei@suse.com>
- Update to version 2.12.04 (bsc#1235140)
+ Remove agent-no-auto-update.patch handeled by config file specialization
sub-packages
+ Remove paa_force_py3_sle15.patch handled by RPM macro
+ Remove agent-micro-is-sles.patch included upstream
+ Forward port paa_12_sp5_rdma_no_ext_driver.patch
+ Forward port remove-mock.patch
+ Add paa_direct_exec_in_service.patch
~ The waagent script is executable and we set the proper interpreter
using the macro for multibuild python. Do prefix the execution in the
service file wit the interpreter
+ Fix install_requires list syntax
+ Update spec file
~ Remove conditions for distros no longer maintained
~ Simplify build and install conditionals using macros
+ Enable GA versioning #3082 #3184 #3189
+ Cgroups api refactor for v2 #3096 #3135 #3188 #3196
+ Fix JIT for FIPS 140-3 #3190
+ reset network service unit file if python version changes #3058
+ Recognize SLE-Micro as a SLE based distribution #3048
+ Add distutils/version.py to azurelinuxagent #3063
+ Use legacycrypt instead of crypt on Python >= 3.13 #3070
+ Fix osutil/default route_add to pass string array. #3072
+ Fix argument to GoalState.init #3073
+ Add lock around access to fast_track.json #3076
+ Add DistroVersion class to compare distro versions #3078
+ LogCollector should skip and log warning for files that don't exist #3098
+ check for unexpected process in agent cgroups before cgroups enabled #3103
+ [Redo with correct source/target]: Remove check for "ibXX" interface
format and rework mac-address regex to expand support #3150
+ Fix Ubuntu version codename for 24.04 #3159
+ Update test certificate data #3166
+ move setupslice after cgroupsv2 check, remove unit file for
log collector and remove fiirewall daemon-reload #3223
+ Address pylint warning deprecated-method #3059
+ Run pylint on Python 3.11 #3067
+ Run unit tests with pytest on Python >= 3.10
+ Log logcollector cgroups if process is found in unexpected slice #3107
+ remove secret and use cert for aad app in e2e pipeline #3116
+ suppress pylint warn contextmanager-generator-missing-cleanup #3138
+ Switching to SNI based authentication for aad app #3137
+ updated PR template #3144
+ Avoiding mocked exception from being lost on test when using
python 3.12: complete mocked info #3149
+ Add more useful logging statement for agent unit properties #3154
+ Remove wireserver fallback for imds calls #3152
+ Remove unused import #3155
+ Add support for Azure Linux 3 #3183
+ Fix pytest warnings #3084
+ Allow use of node 16 #3160
+ Send controller/cgroup path telemetry #3231
From 2.13.0.2
+ #3221 Add support for nftables (+ refactoring of firewall code)
+ #3239 Create walinuxagent nftable atomically
+ Features in progress (Verify extension signature/Policy Enforcement)
+ #3200 Parse encodedSignature property from EGS
+ #3187 Add Regorus policy engine framework
+ #3222 Remove Regorus and platform check for policy enforcement
+ #3242 Telemetry (update logcollector telemetry with common properties)
+ #3208 Handle non-boolean when parsing extension manifests
+ #3211 Fix unicode type check when parsing extension manifests
+ #3133 Telemetry: high-priority events
+ #3240 Telemetry: report apparent dead code
+ #3210 Cleanup: remove AMA extension services cgroups tracking code
+ #3197 Accommodate the new behavior in OpenSSL 3.2.2 when given an
empty input
From 2.11.1.12
+ Remove multi config extension status only on extension delete #3172
From 2.111.1.4
+ General Improvements
+ Improvements in telemetry for firewall settings #3110, #3124
From 2.10.0.8
+ GA versioning #2810 #2850 #2860 #2881 #2974 #3004 #3015 #3033
+ Disabled GA versioning #2909 #2917 #3044
+ Add regular expression to match logs from very old agents #2839
+ Remove empty "distro" module #2854
+ Enable Python 2.7 for unit tests #2856
+ Add check for noexec on Permission denied errors #2859
+ Reorganize file structure of unit tests #2894
+ Report useful message when extension processing is disabled #2895
+ Add log and telemetry event for extension disabled #2897
+ Cleanup common directory #2902
+ Fix agent memory usage check #2903
+ enable rhel/centos agent-cgroups #2922
+ Add support for EC certificates #2936
+ Add Cpu Arch in local logs and telemetry events #2938
+ Clarify support status of installing from source. #2941
+ Gathering Guest ProxyAgent Log Files #2975
+ Remove debug info from waagent.status.json #2971
+ Handle errors when adding logs to the archive #2982
+ Update supported Ubuntu versions #2980
+ Fix pylint warning #2988
+ Add information about HTTP proxies #2985
+ update the proxy agenet log folder for logcollector #3028
+ Add config parameter to wait for cloud-init
(Extensions.WaitForCloudInit) #3031 [Added in 2.10.0.8]
+ Adding AutoUpdate.UpdateToLatestVersion new flag support #3020 #3027
[Added in 2.10.0.8]
+ Check certificates only if certificates are included in goal state #2803
+ Redact access tokens from extension's output #2811
+ Fix name of single IB device when provisioning RDMA #2814
+ Port NSBSD system to the latest version of waagent #2828
+ fix daemon version #2874
+ fix version checking in setup.py #2920
+ fix(ubuntu): Point to correct dhcp lease files #2979
+ Download certs on FT GS after check_certificates only when missing
from disk #2907
+ Add support for EC certificates (#2936) #2943 [Added in 2.10.0.5]
+ Fix for "local variable _COLLECT_NOEXEC_ERRORS referenced before
assignment" (#2935) #2944 [Added in 2.10.0.5]
+ Cache daemon version #2942 #2946 [Added in 2.10.0.5]
+ undo get daemon version change #2951 [Added in 2.10.0.5]
+ fix self-update frequency to spread over 24 hrs for regular type
and 4 hrs for hotfix #2948 [Added in 2.10.0.5]
+ ignore dependencies from extensions that do not have settings #2957
[Added in 2.10.0.6]
+ Do not reset the mode of a extension's log directory #3014
[Added in 2.10.0.8]
+ skip cgroup monitoring if log collector doesn't start by the agent.
#2939 [Added in 2.10.0.8]
+ NM should not be restarted during hostname publish if NM_CONTROLLED=y
#3008 [Added in 2.10.0.8]
+ Daemon should remove stale published_hostname file and log
useful warning #3016 [Added in 2.10.0.8]
+ Revert changes to publish_hostname in RedhatOSModernUtil #3032
[Added in 2.10.0.8]
+ Recover primary nic if down after publishing hostname in
RedhatOSUtil #3024 [Added in 2.10.0.8]
-------------------------------------------------------------------
Thu Oct 31 09:50:45 UTC 2024 - Dirk Müller <dmueller@suse.com>
- fix a few typos in the spec file and use proper macros where
applicable
- remove python3 requires
-------------------------------------------------------------------
Mon Aug 19 11:14:11 UTC 2024 - Robert Schweikert <rjschwei@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-azure-agent
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,34 +16,42 @@
#
%if 0%{?suse_version} >= 1600
%define pythons %{primary_python}
%elif 0%{?suse_version} = 1315
%define pythons python
%else
%define pythons python3
%endif
%global _sitelibdir %{%{pythons}_sitelib}
Name: python-azure-agent
Version: 2.12.0.4
Release: 0
Summary: Microsoft Azure Linux Agent
License: Apache-2.0
Group: System/Daemons
Version: 2.9.1.1
Release: 0
URL: https://github.com/Azure/WALinuxAgent
Source0: WALinuxAgent-%{version}.tar.gz
Patch1: agent-no-auto-update.patch
Patch6: paa_force_py3_sle15.patch
Patch7: reset-dhcp-deprovision.patch
Patch8: paa_12_sp5_rdma_no_ext_driver.patch
# PATCH-FIX-UPSTREAM gh#Azure/WALinuxAgent#2741
Patch9: remove-mock.patch
Patch10: agent-micro-is-sles.patch
# PATCH-FIX-UPSTREAM gh#Azure/WALinuxAgent#3158
Patch11: agent-btrfs-use-f.patch
Patch12: paa_direct_exec_in_service.patch
BuildRequires: dos2unix
BuildRequires: %{pythons}-pip
BuildRequires: %{pythons}-setuptools
BuildRequires: %{pythons}-wheel
BuildRequires: distribution-release
BuildRequires: openssl
BuildRequires: python-rpm-macros
%if 0%{?suse_version} > 1315
BuildRequires: python3-distro
BuildRequires: python3-setuptools
BuildRequires: %{pythons}-distro
%else
BuildRequires: python-setuptools
BuildRequires: python-xml
BuildRequires: %{pythons}-xml
%endif
BuildRequires: pkgconfig(udev)
Requires: eject
@ -58,13 +66,10 @@ Requires: sysvinit-tools
%if 0%{?suse_version} && 0%{?suse_version} <= 1500
Requires: wicked
%endif
Requires: %{pythons}-pyasn1
Requires: %{pythons}-xml
%if 0%{?suse_version} > 1315
Requires: python3-distro
Requires: python3-pyasn1
Requires: python3-xml
%else
Requires: python-pyasn1
Requires: python-xml
Requires: %{pythons}-distro
%endif
Requires: sudo
Requires: util-linux
@ -87,13 +92,11 @@ Microsoft Azure Stack framework.
%package test
Summary: Unit tests
Group: Development/Languages/Python
Requires: %{name} == %{version}
Requires: %{name} = %{version}
Requires: %{pythons}-pytest
Requires: openssl
%if 0%{?suse_version} > 1315
Requires: python3-pytest
%else
Requires: python-mock
Requires: python-pytest
%if 0%{?suse_version} == 1315
Requires: %{pythons}-mock
%endif
%description test
@ -102,9 +105,9 @@ Unit tests for python-azure-agent.
%package config-default
Summary: Default upstream configuration
Group: Development/Languages/Python
Requires: %{name} == %{version}
Provides: waagent-config
Requires: %{name} = %{version}
Conflicts: waagent-config
Provides: waagent-config
%description config-default
The default configuration for the agent as supplied by upstream for SUSE
@ -112,9 +115,9 @@ The default configuration for the agent as supplied by upstream for SUSE
%package config-server
Summary: SUSE specific configuration for server products
Group: Development/Languages/Python
Requires: %{name} == %{version}
Provides: waagent-config
Requires: %{name} = %{version}
Conflicts: waagent-config
Provides: waagent-config
%description config-server
Modified waagent.conf file to meet SUSE policies and SUSE image build
@ -123,9 +126,9 @@ setup
%package config-hpc
Summary: SUSE specific configuration for HPC
Group: Development/Languages/Python
Requires: %{name} == %{version}
Provides: waagent-config
Requires: %{name} = %{version}
Conflicts: waagent-config
Provides: waagent-config
%description config-hpc
Modified waagent.conf file to meet SUSE policies and SUSE image build
@ -134,39 +137,35 @@ setup
%package config-micro
Summary: SUSE specific configuration for Micro
Group: Development/Languages/Python
Requires: %{name} == %{version}
Provides: waagent-config
Requires: %{name} = %{version}
Conflicts: waagent-config
Provides: waagent-config
%description config-micro
Modified waagent.conf file to meet SUSE policies and SUSE image build
setup
%prep
%setup -qn WALinuxAgent-%{version}
%patch -P 1
%if 0%{?suse_version} > 1315
%patch -P 6
%endif
%setup -q -n WALinuxAgent-%{version}
%patch -P 7
%patch -P 8
%patch -P 8 -p1
%patch -P 9 -p1
%patch -P 10
%patch -P 11
%patch -P 12
%build
%if 0%{?suse_version} > 1315
python3 setup.py build
%else
python setup.py build
%endif
# We have an insane veriation in the way we identify our distros from suse,
# sles, opensuse, openSUSE Tumbleweed and who knows what else. This makes it
# for all intend and purposes impractical to follow the bouncing ball and keep
# updating the upstream detection code. We use setup.py to be able to
# pass an argument during install
%python_build
%install
%python_exec setup.py install --prefix=%{_prefix} --lnx-distro='suse' --root=%{buildroot}
%if 0%{?suse_version} > 1315
python3 setup.py install --prefix=%{_prefix} --lnx-distro='suse' --root=%{buildroot}
rm %{buildroot}/usr/sbin/waagent2.0
%else
python setup.py install --prefix=%{_prefix} --lnx-distro='suse' --root=%{buildroot}
rm %{buildroot}%{_sbindir}/waagent2.0
%python3_fix_shebang
%endif
# Config file flavor setup
@ -209,13 +208,8 @@ mv %{buildroot}/lib/systemd/system/* %{buildroot}/%{_unitdir}
fi
### udev rules
%if 0%{?suse_version} < 1230
mkdir -p %{buildroot}/lib/udev/rules.d
mv %{buildroot}%{_sysconfdir}/udev/rules.d/* %{buildroot}/lib/udev/rules.d/
%else
mkdir -p %{buildroot}/usr/lib/udev/rules.d
mv %{buildroot}%{_sysconfdir}/udev/rules.d/* %{buildroot}/usr/lib/udev/rules.d/
%endif
mkdir -p %{buildroot}%{_prefix}/lib/udev/rules.d
mv %{buildroot}%{_sysconfdir}/udev/rules.d/* %{buildroot}%{_prefix}/lib/udev/rules.d/
### log file ghost
mkdir -p %{buildroot}/%{_localstatedir}/log
touch %{buildroot}/%{_localstatedir}/log/waagent.log
@ -228,19 +222,15 @@ mv %{buildroot}/%{_sysconfdir}/logrotate.d/waagent.logrotate %{buildroot}/%{_sys
%endif
# install tests
%if 0%{?suse_version} > 1315
cp -r tests %{buildroot}/%{python3_sitelib}/azurelinuxagent
%else
cp -r tests %{buildroot}/%{python_sitelib}/azurelinuxagent
%endif
cp -r tests %{buildroot}/%{_sitelibdir}/azurelinuxagent
%pre
%service_add_pre waagent.service
# Handle the case when the -config-* package is not installed, we want to
# preserver the previousl config file that was flavor customized during
# image build
if [ -e /etc/waagent.conf ]; then
cp -Z /etc/waagent.conf /etc/waagent.conf.bak
if [ -e %{_sysconfdir}/waagent.conf ]; then
cp -Z %{_sysconfdir}/waagent.conf %{_sysconfdir}/waagent.conf.bak
fi
%if 0%{?suse_version} > 1500
@ -253,16 +243,16 @@ done
%posttrans
# Do not clobber the config if it was installed from a config package, but
# put the oldfile back if we do not have another config file
if [ ! -e /etc/waagent.conf ]; then
if [ -e /etc/waagent.conf.bak ]; then
mv -Z /etc/waagent.conf.bak /etc/waagent.conf
if [ ! -e %{_sysconfdir}/waagent.conf ]; then
if [ -e %{_sysconfdir}/waagent.conf.bak ]; then
mv -Z %{_sysconfdir}/waagent.conf.bak %{_sysconfdir}/waagent.conf
#restart the waagent.service again the restert in post failed due
# to missing config
systemctl try-restart waagent.service
# Making the assumption that the rpmsave file was generated because of
# of the previously broken package upgrade.
elif [ -e /etc/waagent.conf.rpmsave ]; then
cp -Z /etc/waagent.conf.rpmsave /etc/waagent.conf
elif [ -e %{_sysconfdir}/waagent.conf.rpmsave ]; then
cp -Z %{_sysconfdir}/waagent.conf.rpmsave %{_sysconfdir}/waagent.conf
#restart the waagent.service again the restert in post failed due
# to missing config
systemctl try-restart waagent.service
@ -315,31 +305,18 @@ ln -s %{_sysconfdir}/waagent.conf.micro %{_sysconfdir}/waagent.conf
%endif
%ghost %{_localstatedir}/log/waagent.log
%{_unitdir}/waagent.service
%if 0%{?suse_version} < 1230
/lib/udev/rules.d/66-azure-storage.rules
/lib/udev/rules.d/99-azure-product-uuid.rules
%else
/usr/lib/udev/rules.d/66-azure-storage.rules
/usr/lib/udev/rules.d/99-azure-product-uuid.rules
%endif
%if 0%{?suse_version} > 1315
%dir %{python3_sitelib}/azurelinuxagent
%{python3_sitelib}
%exclude %{python3_sitelib}/azurelinuxagent/tests
%else
%dir %{python_sitelib}/azurelinuxagent
%{_prefix}/lib/udev/rules.d/66-azure-storage.rules
%{_prefix}/lib/udev/rules.d/99-azure-product-uuid.rules
%dir %{_sitelibdir}/azurelinuxagent
%{_sitelibdir}
%exclude %{_sitelibdir}/azurelinuxagent/tests
%if 0%{?suse_version} <= 1315
%attr(0755,root,root) %{_sbindir}/waagent2.0
%{python_sitelib}
%exclude %{python_sitelib}/azurelinuxagent/tests
%endif
%files test
%defattr(0644,root,root,0755)
%if 0%{?suse_version} > 1315
%{python3_sitelib}/azurelinuxagent/tests
%else
%{python_sitelib}/azurelinuxagent/tests
%endif
%{_sitelibdir}/azurelinuxagent/tests
%files config-default
%ghost %{_sysconfdir}/waagent.conf

View File

@ -1,7 +1,7 @@
Index: WALinuxAgent-2.9.1.1/tests/common/dhcp/test_dhcp.py
Index: WALinuxAgent-2.12.0.4/tests/common/dhcp/test_dhcp.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/common/dhcp/test_dhcp.py
+++ WALinuxAgent-2.9.1.1/tests/common/dhcp/test_dhcp.py
--- WALinuxAgent-2.12.0.4.orig/tests/common/dhcp/test_dhcp.py
+++ WALinuxAgent-2.12.0.4/tests/common/dhcp/test_dhcp.py
@@ -15,7 +15,10 @@
# Requires Python 2.6+ and Openssl 1.0+
#
@ -13,11 +13,11 @@ Index: WALinuxAgent-2.9.1.1/tests/common/dhcp/test_dhcp.py
+ import mock
import azurelinuxagent.common.dhcp as dhcp
import azurelinuxagent.common.osutil.default as osutil
from tests.tools import AgentTestCase, open_patch, patch
Index: WALinuxAgent-2.9.1.1/tests/common/osutil/test_default.py
from tests.lib.tools import AgentTestCase, open_patch, patch
Index: WALinuxAgent-2.12.0.4/tests/common/osutil/test_default.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/common/osutil/test_default.py
+++ WALinuxAgent-2.9.1.1/tests/common/osutil/test_default.py
--- WALinuxAgent-2.12.0.4.orig/tests/common/osutil/test_default.py
+++ WALinuxAgent-2.12.0.4/tests/common/osutil/test_default.py
@@ -22,7 +22,10 @@ import subprocess
import tempfile
import unittest
@ -30,11 +30,11 @@ Index: WALinuxAgent-2.9.1.1/tests/common/osutil/test_default.py
import azurelinuxagent.common.conf as conf
import azurelinuxagent.common.osutil.default as osutil
Index: WALinuxAgent-2.9.1.1/tests/common/test_event.py
Index: WALinuxAgent-2.12.0.4/tests/common/test_event.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/common/test_event.py
+++ WALinuxAgent-2.9.1.1/tests/common/test_event.py
@@ -26,7 +26,10 @@ import threading
--- WALinuxAgent-2.12.0.4.orig/tests/common/test_event.py
+++ WALinuxAgent-2.12.0.4/tests/common/test_event.py
@@ -27,7 +27,10 @@ import threading
import xml.dom
from datetime import datetime, timedelta
@ -46,10 +46,10 @@ Index: WALinuxAgent-2.9.1.1/tests/common/test_event.py
from azurelinuxagent.common.utils import textutil, fileutil
from azurelinuxagent.common import event, logger
Index: WALinuxAgent-2.9.1.1/tests/common/test_version.py
Index: WALinuxAgent-2.12.0.4/tests/common/test_version.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/common/test_version.py
+++ WALinuxAgent-2.9.1.1/tests/common/test_version.py
--- WALinuxAgent-2.12.0.4.orig/tests/common/test_version.py
+++ WALinuxAgent-2.12.0.4/tests/common/test_version.py
@@ -20,7 +20,10 @@ from __future__ import print_function
import os
import textwrap
@ -62,42 +62,10 @@ Index: WALinuxAgent-2.9.1.1/tests/common/test_version.py
import azurelinuxagent.common.conf as conf
from azurelinuxagent.common.future import ustr
Index: WALinuxAgent-2.9.1.1/tests/distro/test_scvmm.py
Index: WALinuxAgent-2.12.0.4/tests/ga/test_collect_telemetry_events.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/distro/test_scvmm.py
+++ WALinuxAgent-2.9.1.1/tests/distro/test_scvmm.py
@@ -20,7 +20,10 @@
import os
import unittest
-import mock
+try:
+ from unittest import mock
+except ImportError:
+ import mock
import azurelinuxagent.daemon.scvmm as scvmm
from azurelinuxagent.common import conf
Index: WALinuxAgent-2.9.1.1/tests/ga/mocks.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/ga/mocks.py
+++ WALinuxAgent-2.9.1.1/tests/ga/mocks.py
@@ -17,7 +17,10 @@
import contextlib
-from mock import PropertyMock
+try:
+ from unittest.mock import PropertyMock
+except ImportError:
+ from mock import PropertyMock
from azurelinuxagent.ga.exthandlers import ExtHandlersHandler
from azurelinuxagent.ga.remoteaccess import RemoteAccessHandler
from azurelinuxagent.ga.update import UpdateHandler, get_update_handler
Index: WALinuxAgent-2.9.1.1/tests/ga/test_collect_telemetry_events.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/ga/test_collect_telemetry_events.py
+++ WALinuxAgent-2.9.1.1/tests/ga/test_collect_telemetry_events.py
--- WALinuxAgent-2.12.0.4.orig/tests/ga/test_collect_telemetry_events.py
+++ WALinuxAgent-2.12.0.4/tests/ga/test_collect_telemetry_events.py
@@ -26,7 +26,10 @@ import string
import uuid
from collections import defaultdict
@ -110,10 +78,10 @@ Index: WALinuxAgent-2.9.1.1/tests/ga/test_collect_telemetry_events.py
from azurelinuxagent.common import conf
from azurelinuxagent.common.event import EVENTS_DIRECTORY
Index: WALinuxAgent-2.9.1.1/tests/ga/test_remoteaccess_handler.py
Index: WALinuxAgent-2.12.0.4/tests/ga/test_remoteaccess_handler.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/ga/test_remoteaccess_handler.py
+++ WALinuxAgent-2.9.1.1/tests/ga/test_remoteaccess_handler.py
--- WALinuxAgent-2.12.0.4.orig/tests/ga/test_remoteaccess_handler.py
+++ WALinuxAgent-2.12.0.4/tests/ga/test_remoteaccess_handler.py
@@ -16,7 +16,10 @@
#
from datetime import timedelta, datetime
@ -126,10 +94,10 @@ Index: WALinuxAgent-2.9.1.1/tests/ga/test_remoteaccess_handler.py
from azurelinuxagent.common.osutil.default import DefaultOSUtil
from azurelinuxagent.common.protocol.goal_state import RemoteAccess
from azurelinuxagent.common.protocol.util import ProtocolUtil
Index: WALinuxAgent-2.9.1.1/tests/ga/test_send_telemetry_events.py
Index: WALinuxAgent-2.12.0.4/tests/ga/test_send_telemetry_events.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/ga/test_send_telemetry_events.py
+++ WALinuxAgent-2.9.1.1/tests/ga/test_send_telemetry_events.py
--- WALinuxAgent-2.12.0.4.orig/tests/ga/test_send_telemetry_events.py
+++ WALinuxAgent-2.12.0.4/tests/ga/test_send_telemetry_events.py
@@ -24,7 +24,10 @@ import time
import uuid
from datetime import datetime, timedelta
@ -142,19 +110,19 @@ Index: WALinuxAgent-2.9.1.1/tests/ga/test_send_telemetry_events.py
from azurelinuxagent.common import logger
from azurelinuxagent.common.datacontract import get_properties
Index: WALinuxAgent-2.9.1.1/tests/utils/test_network_util.py
Index: WALinuxAgent-2.12.0.4/tests/lib/mock_update_handler.py
===================================================================
--- WALinuxAgent-2.9.1.1.orig/tests/utils/test_network_util.py
+++ WALinuxAgent-2.9.1.1/tests/utils/test_network_util.py
@@ -16,7 +16,10 @@
#
import subprocess
--- WALinuxAgent-2.12.0.4.orig/tests/lib/mock_update_handler.py
+++ WALinuxAgent-2.12.0.4/tests/lib/mock_update_handler.py
@@ -17,7 +17,10 @@
-from mock.mock import patch
import contextlib
-from mock import PropertyMock
+try:
+ from unittest.mock import patch
+ from unittest.mock import PropertyMock
+except ImportError:
+ from mock import patch
+ from mock import PropertyMock
import azurelinuxagent.common.utils.networkutil as networkutil
from tests.tools import AgentTestCase
from azurelinuxagent.ga.agent_update_handler import AgentUpdateHandler
from azurelinuxagent.ga.exthandlers import ExtHandlersHandler