Sync from SUSE:SLFO:Main python-azure-agent revision 8292f88fd857076a1868c3be59e76efe

This commit is contained in:
Adrian Schröter 2024-08-21 17:35:25 +02:00
parent 63c0bfff3c
commit e7d5f66606
3 changed files with 111 additions and 19 deletions

11
agent-btrfs-use-f.patch Normal file
View File

@ -0,0 +1,11 @@
--- azurelinuxagent/daemon/resourcedisk/default.py.orig
+++ azurelinuxagent/daemon/resourcedisk/default.py
@@ -124,7 +124,7 @@ class ResourceDiskHandler(object):
"{0}: {1}".format(device, ret[1]))
force_option = 'F'
- if self.fs == 'xfs':
+ if self.fs in ('btrfs', 'xfs'):
force_option = 'f'
mkfs_string = "mkfs.{0} -{2} {1}".format(
self.fs, partition, force_option)

View File

@ -1,3 +1,56 @@
-------------------------------------------------------------------
Mon Aug 19 11:14:11 UTC 2024 - Robert Schweikert <rjschwei@suse.com>
- Restart the agent (bsc#1227600)
+ The agent service gets restarted in post but may fail due to a missing
config file. config files were split into their own package previously.
When we detect that we have to restore a config file we also need
to restart the agent again.
-------------------------------------------------------------------
Fri Jul 12 15:41:55 UTC 2024 - Robert Schweikert <rjschwei@suse.com>
- Add agent-btrfs-use-f.patch (bsc#1227711)
+ Use the proper option to force btrfs to overwrite a file system on the
resource disk if one already exists.
-------------------------------------------------------------------
Wed Jul 10 15:09:56 UTC 2024 - Joachim Gleissner <jgleissner@suse.com>
- Set Provisioning.Agent parameter to 'cloud-init' in SLE Micro >= 5.5
(bsc#1227106).
- Do not package waagent2.0 in Python 3 builds.
- Drop obsolete otherproviders keyword from Conflicts statements
-------------------------------------------------------------------
Mon Jul 1 09:53:19 UTC 2024 - Joachim Gleissner <jgleissner@suse.com>
- Do not require wicked in non-SUSE build environments.
-------------------------------------------------------------------
Wed Jun 26 10:14:35 UTC 2024 - Joachim Gleissner <jgleissner@suse.com>
- Apply python3 interpreter patch in non SLE build environments
(bcs#1227067)
- Simplify %suse_version conditionals
-------------------------------------------------------------------
Wed Jun 5 18:58:43 UTC 2024 - Robert Schweikert <rjschwei@suse.com>
- Use the -Z option for mv and cp in the posttrans to properly handle
SELinux context (bsc#1225946)
-------------------------------------------------------------------
Wed Apr 10 22:53:47 UTC 2024 - Robert Schweikert <rjschwei@suse.com>
- Keep the existing config file (bsc#1222620)
+ During separation of the config file into subpackages it was forgotten
that on update of the main package the previously provided config file
would be removed. SInce we do not know which flavor of our images the
package is being upgraded on, preserve the previously existing config
file. This will orphan the file if non of the -config-* packages gets
installed.
-------------------------------------------------------------------
Tue Feb 20 20:07:51 UTC 2024 - Robert Schweikert <rjschwei@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-azure-agent
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -31,12 +31,14 @@ 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
BuildRequires: dos2unix
BuildRequires: distribution-release
BuildRequires: openssl
BuildRequires: python-rpm-macros
%if 0%{?suse_version} && 0%{?suse_version} > 1315
%if 0%{?suse_version} > 1315
BuildRequires: python3-distro
BuildRequires: python3-setuptools
%else
@ -56,7 +58,7 @@ Requires: sysvinit-tools
%if 0%{?suse_version} && 0%{?suse_version} <= 1500
Requires: wicked
%endif
%if 0%{?suse_version} && 0%{?suse_version} > 1315
%if 0%{?suse_version} > 1315
Requires: python3-distro
Requires: python3-pyasn1
Requires: python3-xml
@ -102,7 +104,7 @@ Summary: Default upstream configuration
Group: Development/Languages/Python
Requires: %{name} == %{version}
Provides: waagent-config
Conflicts: otherproviders(waagent-config)
Conflicts: waagent-config
%description config-default
The default configuration for the agent as supplied by upstream for SUSE
@ -112,7 +114,7 @@ Summary: SUSE specific configuration for server products
Group: Development/Languages/Python
Requires: %{name} == %{version}
Provides: waagent-config
Conflicts: otherproviders(waagent-config)
Conflicts: waagent-config
%description config-server
Modified waagent.conf file to meet SUSE policies and SUSE image build
@ -123,7 +125,7 @@ Summary: SUSE specific configuration for HPC
Group: Development/Languages/Python
Requires: %{name} == %{version}
Provides: waagent-config
Conflicts: otherproviders(waagent-config)
Conflicts: waagent-config
%description config-hpc
Modified waagent.conf file to meet SUSE policies and SUSE image build
@ -134,7 +136,7 @@ Summary: SUSE specific configuration for Micro
Group: Development/Languages/Python
Requires: %{name} == %{version}
Provides: waagent-config
Conflicts: otherproviders(waagent-config)
Conflicts: waagent-config
%description config-micro
Modified waagent.conf file to meet SUSE policies and SUSE image build
@ -143,24 +145,26 @@ setup
%prep
%setup -qn WALinuxAgent-%{version}
%patch -P 1
%if 0%{?suse_version} && 0%{?suse_version} > 1315 && 0%{?sle_version}
%if 0%{?suse_version} > 1315
%patch -P 6
%endif
%patch -P 7
%patch -P 8
%patch -P 9 -p1
%patch -P 10
%patch -P 11
%build
%if 0%{?suse_version} && 0%{?suse_version} > 1315
%if 0%{?suse_version} > 1315
python3 setup.py build
%else
python setup.py build
%endif
%install
%if 0%{?suse_version} && 0%{?suse_version} > 1315
%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}
%endif
@ -185,8 +189,10 @@ cp %{buildroot}%{_sysconfdir}/waagent.conf %{buildroot}%{_sysconfdir}/waagent.co
# Micro setup
# Undo the HPC change
sed -i -e "s/OS.EnableRDMA=y/# OS.EnableRDMA=y/" %{buildroot}%{_sysconfdir}/waagent.conf
# Use Ignition/Afterburn in Micro
%if 0%{?sle_version} && 0%{?sle_version} < 150500
# Use Ignition/Afterburn in Micro < 5.5
sed -i -e "s/Provisioning.Agent=cloud-init/Provisioning.Agent=disabled/" %{buildroot}%{_sysconfdir}/waagent.conf
%endif
# No extension support for transactional-upfdate systems
# There's an inherant bug in that root password reset is also treated via this
# switch
@ -213,8 +219,6 @@ mv %{buildroot}%{_sysconfdir}/udev/rules.d/* %{buildroot}/usr/lib/udev/rules.d/
### log file ghost
mkdir -p %{buildroot}/%{_localstatedir}/log
touch %{buildroot}/%{_localstatedir}/log/waagent.log
### permissinon fixes
chmod +x %{buildroot}/%{_sbindir}/waagent2.0
### naming issues
%if 0%{?suse_version} > 1500
mkdir -p %{buildroot}%{_distconfdir}/logrotate.d
@ -224,7 +228,7 @@ mv %{buildroot}/%{_sysconfdir}/logrotate.d/waagent.logrotate %{buildroot}/%{_sys
%endif
# install tests
%if 0%{?suse_version} && 0%{?suse_version} > 1315
%if 0%{?suse_version} > 1315
cp -r tests %{buildroot}/%{python3_sitelib}/azurelinuxagent
%else
cp -r tests %{buildroot}/%{python_sitelib}/azurelinuxagent
@ -232,6 +236,13 @@ cp -r tests %{buildroot}/%{python_sitelib}/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
fi
%if 0%{?suse_version} > 1500
# Prepare for migration to /usr/etc; save any old .rpmsave
for i in logrotate.d/waagent ; do
@ -239,11 +250,28 @@ for i in logrotate.d/waagent ; do
done
%endif
%if 0%{?suse_version} > 1500
%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
#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
#restart the waagent.service again the restert in post failed due
# to missing config
systemctl try-restart waagent.service
fi
fi
%if 0%{?suse_version} > 1500
# Migration to /usr/etc, restore just created .rpmsave
for i in logrotate.d/waagent ; do
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||:
test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||:
done
%endif
@ -280,7 +308,6 @@ ln -s %{_sysconfdir}/waagent.conf.micro %{_sysconfdir}/waagent.conf
%exclude %{_sysconfdir}/waagent.conf*
%{_sbindir}/rcwaagent
%attr(0755,root,root) %{_sbindir}/waagent
%attr(0755,root,root) %{_sbindir}/waagent2.0
%if 0%{?suse_version} > 1500
%{_distconfdir}/logrotate.d/waagent
%else
@ -295,19 +322,20 @@ ln -s %{_sysconfdir}/waagent.conf.micro %{_sysconfdir}/waagent.conf
/usr/lib/udev/rules.d/66-azure-storage.rules
/usr/lib/udev/rules.d/99-azure-product-uuid.rules
%endif
%if 0%{?suse_version} && 0%{?suse_version} > 1315
%if 0%{?suse_version} > 1315
%dir %{python3_sitelib}/azurelinuxagent
%{python3_sitelib}
%exclude %{python3_sitelib}/azurelinuxagent/tests
%else
%dir %{python_sitelib}/azurelinuxagent
%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} && 0%{?suse_version} > 1315
%if 0%{?suse_version} > 1315
%{python3_sitelib}/azurelinuxagent/tests
%else
%{python_sitelib}/azurelinuxagent/tests