Sync from SUSE:ALP:Source:Standard:1.0 python-azure-agent revision 1d9bca917a95f673a7a42b1bef33de07

This commit is contained in:
2024-08-14 14:39:33 +02:00
parent 01af9e93b5
commit cec192301d
3 changed files with 96 additions and 19 deletions

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,22 @@ 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
# 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
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 +302,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 +316,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