cloud-init/cloud-init.spec

323 lines
11 KiB
RPMSpec
Raw Normal View History

%if 0%{?rhel}
%bcond_with tests
%else
%bcond_without tests
%endif
Name: cloud-init
Version: 24.1.4
Release: 1%{?dist}
2011-09-23 21:10:32 +00:00
Summary: Cloud instance init scripts
License: Apache-2.0 OR GPL-3.0-only
URL: https://github.com/canonical/cloud-init
2017-01-27 02:22:27 +00:00
Source0: %{url}/archive/%{version}/%{version}.tar.gz
2017-10-04 23:48:41 +00:00
Source1: cloud-init-tmpfiles.conf
Patch1: 0001-Add-initial-redhat-changes.patch
Patch2: 0002-fix-rhel-Fix-network-ordering-in-sysconfig.patch
Patch3: 0003-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch
Patch4: 0004-Setting-autoconnect-priority-setting-for-network-scr.patch
Patch5: 0005-feat-Use-NetworkManager-renderer-by-default-in-RHEL-.patch
BuildArch: noarch
2011-09-23 17:44:26 +00:00
BuildRequires: systemd-rpm-macros
BuildRequires: python3-devel
BuildRequires: pkgconfig(systemd)
%if %{with tests}
BuildRequires: iproute
BuildRequires: passwd
2023-12-22 15:12:27 +00:00
BuildRequires: procps-ng
2017-10-04 23:48:41 +00:00
# dnf is needed to make cc_ntp unit tests work
# https://bugs.launchpad.net/cloud-init/+bug/1721573
BuildRequires: /usr/bin/dnf
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pytest-mock)
BuildRequires: python3dist(responses)
2023-12-22 15:12:27 +00:00
BuildRequires: python3dist(passlib)
%endif
# ISC DHCP is no longer maintained and cloud-init will ship a
# release with dhcpcd support soon. See BZ 2247055 for details.
#
# Cloud-init dhcpcd support is pending a release here:
# https://github.com/canonical/cloud-init/pull/4746/files
Requires: dhcp-client
Requires: hostname
2011-09-23 17:44:26 +00:00
Requires: e2fsprogs
Requires: iproute
Requires: python3-libselinux
2011-09-23 17:44:26 +00:00
Requires: net-tools
Requires: policycoreutils-python3
2011-09-23 17:44:26 +00:00
Requires: procps
Requires: shadow-utils
2016-07-07 01:38:38 +00:00
Requires: util-linux
Requires: xfsprogs
# https://bugzilla.redhat.com/show_bug.cgi?id=1974262
Requires: gdisk
Requires: openssl
2016-07-07 01:38:38 +00:00
%{?systemd_requires}
2011-09-23 17:44:26 +00:00
%description
Cloud-init is a set of init scripts for cloud instances. Cloud instances
need special scripts to run during initialization to retrieve and install
ssh keys and to let the user run various scripts.
%prep
%autosetup -p1
2011-09-23 17:44:26 +00:00
2015-02-21 20:25:24 +00:00
# Change shebangs
sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/env python3|' \
-e 's|#!/usr/bin/python|#!/usr/bin/python3|' tools/* cloudinit/ssh_util.py
# Removing shebang manually because of rpmlint, will update upstream later
sed -i -e 's|#!/usr/bin/python||' cloudinit/cmd/main.py
# Use unittest from the standard library. unittest2 is old and being
# retired in Fedora. See https://bugzilla.redhat.com/show_bug.cgi?id=1794222
find tests/ -type f | xargs sed -i s/unittest2/unittest/
2022-02-22 13:19:16 +00:00
find tests/ -type f | xargs sed -i s/assertItemsEqual/assertCountEqual/
2011-09-23 17:44:26 +00:00
%generate_buildrequires
%pyproject_buildrequires
2011-09-23 17:44:26 +00:00
%build
2017-04-17 23:15:46 +00:00
%py3_build
2011-09-23 17:44:26 +00:00
%install
2017-04-17 23:15:46 +00:00
%py3_install -- --init-system=systemd
2011-09-23 17:44:26 +00:00
2022-05-19 13:44:52 +00:00
# Generate cloud-config file
2023-12-22 15:12:27 +00:00
python3 tools/render-template --variant %{?rhel:rhel}%{!?rhel:fedora} > $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg
2013-04-07 04:10:15 +00:00
mkdir -p $RPM_BUILD_ROOT/var/lib/cloud
# /run/cloud-init needs a tmpfiles.d entry
mkdir -p $RPM_BUILD_ROOT/run/cloud-init
2016-07-07 01:38:38 +00:00
mkdir -p $RPM_BUILD_ROOT/%{_tmpfilesdir}
2017-10-04 23:48:41 +00:00
cp -p %{SOURCE1} $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf
2011-09-23 17:44:26 +00:00
2011-09-24 02:32:58 +00:00
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d
cp -p tools/21-cloudinit.conf $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf
2011-09-23 17:44:26 +00:00
# installing man pages
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1/
for man in cloud-id.1 cloud-init.1 cloud-init-per.1; do
install -c -m 0644 doc/man/${man} ${RPM_BUILD_ROOT}%{_mandir}/man1/${man}
chmod -x ${RPM_BUILD_ROOT}%{_mandir}/man1/*
done
# Put files in /etc/systemd/system in the right place
cp -a %{buildroot}/etc/systemd %{buildroot}/usr/lib
rm -rf %{buildroot}/etc/systemd
%check
%if %{with tests}
python3 -m pytest tests/unittests
%else
%py3_check_import cloudinit
%endif
2016-07-07 01:38:38 +00:00
2011-09-23 17:44:26 +00:00
%post
2016-07-07 01:38:38 +00:00
%systemd_post cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service
if [ $1 -eq 1 ] ; then
# Initial installation
# Enabled by default per "runs once then goes away" exception
/bin/systemctl enable cloud-config.service >/dev/null 2>&1 || :
/bin/systemctl enable cloud-final.service >/dev/null 2>&1 || :
/bin/systemctl enable cloud-init.service >/dev/null 2>&1 || :
/bin/systemctl enable cloud-init-local.service >/dev/null 2>&1 || :
/bin/systemctl enable cloud-init.target >/dev/null 2>&1 || :
elif [ $1 -eq 2 ]; then
# Upgrade
# RHBZ 2210012 - check for null ssh_genkeytypes value in cloud.cfg that
# breaks ssh connectivity after upgrade to a newer version of cloud-init.
if [ -f %{_sysconfdir}/cloud/cloud.cfg.rpmnew ] && grep -q '^\s*ssh_genkeytypes:\s*~\s*$' %{_sysconfdir}/cloud/cloud.cfg ; then
echo "***********************************************"
echo "*** WARNING!!!! ***"
echo ""
echo "ssh_genkeytypes set to null in /etc/cloud/cloud.cfg!"
echo "SSH access might be broken after reboot. Please check the following KCS"
echo "for more detailed information:"
echo ""
echo "https://access.redhat.com/solutions/6988034"
echo ""
echo "Please reconcile the differences between /etc/cloud/cloud.cfg and "
echo "/etc/cloud/cloud.cfg.rpmnew and update ssh_genkeytypes configuration in "
echo "/etc/cloud/cloud.cfg to a list of keytype values, something like:"
echo "ssh_genkeytypes: ['rsa', 'ecdsa', 'ed25519']"
echo ""
echo "************************************************"
fi
# If the upgrade is from a version older than 0.7.9-8,
# there will be stale systemd config
/bin/systemctl is-enabled cloud-config.service >/dev/null 2>&1 &&
/bin/systemctl reenable cloud-config.service >/dev/null 2>&1 || :
2011-09-23 17:44:26 +00:00
%preun
2016-07-07 01:38:38 +00:00
%systemd_preun cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service
2011-09-23 17:44:26 +00:00
%postun
%systemd_postun cloud-config.service cloud-config.target cloud-final.service cloud-init.service cloud-init.target cloud-init-local.service
2011-09-23 17:44:26 +00:00
if [ $1 -eq 0 ] ; then
# warn during package removal not upgrade
if [ -f /etc/ssh/sshd_config.d/50-cloud-init.conf ] ; then
echo "/etc/ssh/sshd_config.d/50-cloud-init.conf not removed"
fi
if [ -f /etc/NetworkManager/conf.d/99-cloud-init.conf ] ; then
echo "/etc/NetworkManager/conf.d/99-cloud-init.conf not removed"
fi
if [ -f /etc/NetworkManager/conf.d/30-cloud-init-ip6-addr-gen-mode.conf ] ; then
echo "/etc/NetworkManager/conf.d/30-cloud-init-ip6-addr-gen-mode.conf not removed"
fi
fi
2011-09-23 17:44:26 +00:00
%files
2017-10-04 23:48:41 +00:00
%license LICENSE LICENSE-Apache2.0 LICENSE-GPLv3
%doc ChangeLog
2015-08-16 03:46:03 +00:00
%doc doc/*
%{_mandir}/man1/*
2011-09-24 02:32:58 +00:00
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
%dir %{_sysconfdir}/cloud/cloud.cfg.d
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg
%doc %{_sysconfdir}/cloud/cloud.cfg.d/README
%dir %{_sysconfdir}/cloud/templates
%config(noreplace) %{_sysconfdir}/cloud/templates/*
2016-09-30 00:55:32 +00:00
%dir %{_sysconfdir}/rsyslog.d
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
2023-03-22 13:35:32 +00:00
%{_udevrulesdir}/66-azure-ephemeral.rules
2011-09-23 17:44:26 +00:00
%{_unitdir}/cloud-config.service
%{_unitdir}/cloud-final.service
%{_unitdir}/cloud-init.service
2016-07-07 01:38:38 +00:00
%{_unitdir}/cloud-init-local.service
%{_unitdir}/cloud-config.target
%{_unitdir}/cloud-init.target
/usr/lib/systemd/system-generators/cloud-init-generator
%{_unitdir}/cloud-init-hotplugd.service
%{_unitdir}/cloud-init-hotplugd.socket
%{_unitdir}/sshd-keygen@.service.d/disable-sshd-keygen-if-cloud-init-active.conf
%{_tmpfilesdir}/%{name}.conf
%{python3_sitelib}/*
2011-09-23 17:44:26 +00:00
%{_libexecdir}/%{name}
2011-09-24 02:32:58 +00:00
%{_bindir}/cloud-init*
%{_bindir}/cloud-id
%dir /run/cloud-init
%dir /var/lib/cloud
%{_datadir}/bash-completion/completions/cloud-init
2011-09-23 17:44:26 +00:00
%changelog
* Mon Apr 22 2024 Miroslav Rezanina <mrezanin@redhat.com> - 24.1.4-1
- Rebase to 24.1.4 [RHEL-33439]
- Resolves: RHEL-33439
(Update cloud-init on 24.1.4 for RHEL 10)
* Thu Feb 01 2024 Major Hayden <major@redhat.com> - 23.4.1-5
- Switch back to dhcp-client temporarily
* Tue Jan 30 2024 Major Hayden <major@redhat.com> - 23.4.1-4
- Replace dhcp-client with udhcpc
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 23.4.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 23.4.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Dec 22 2023 František Zatloukal <fzatlouk@redhat.com> - 23.4.1-1
- Update to 23.4.1
* Fri Aug 11 2023 Miroslav Suchý <msuchy@redhat.com> - 23.2.1-2
- correct SPDX formula
* Thu Jul 20 2023 Major Hayden <major@redhat.com> - 23.2.1-1
- Update to 23.2.1
* Thu Jul 20 2023 Major Hayden <major@redhat.com> - 23.2-4
- Add packit config
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 23.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jun 29 2023 Python Maint <python-maint@redhat.com> - 23.2-2
- Rebuilt for Python 3.12
* Thu Jun 22 2023 Major Hayden <major@redhat.com> - 23.2-1
- Update to 23.2 rhbz#2196523
* Wed May 17 2023 Major Hayden <major@redhat.com> - 23.1.2-10
- Migrate to pyproject-rpm-macros for build requirements
* Tue May 16 2023 Major Hayden <major@redhat.com> - 23.1.2-9
- ec2: Do not enable DHCPv6 on EC2
* Tue May 16 2023 Yaakov Selkowitz <yselkowi@redhat.com> - 23.1.2-8
- Disable tests by default in RHEL builds
* Thu May 11 2023 Major Hayden <major@redhat.com> - 23.1.2-7
- Update changelog for rhbz#2068529
* Thu May 11 2023 Major Hayden <major@redhat.com> - 23.1.2-6
- Allow > 3 nameservers to be used rhbz#2068529
* Sun Apr 30 2023 Neal Gompa <ngompa@fedoraproject.org> - 23.1.2-5
- Use the correct SourceURL format for the upstream sources
- Switch to SPDX identifiers for the license field
* Fri Apr 28 2023 Major Hayden <major@redhat.com> - 23.1.2-4
- Switch to GitHub for upstream source
* Fri Apr 28 2023 Major Hayden <major@redhat.com> - 23.1.2-3
- Revert "Use forge source"
* Fri Apr 28 2023 Major Hayden <major@redhat.com> - 23.1.2-2
- Use forge source
* Thu Apr 27 2023 Major Hayden <major@redhat.com> - 23.1.2-1
- Update to 23.1.2
* Thu Mar 23 2023 František Zatloukal <fzatlouk@redhat.com> - 23.1.1-1
- Rebase to 23.1.1
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 22.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 22.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jun 16 2022 Python Maint <python-maint@redhat.com> - 22.2-3
- Rebuilt for Python 3.11
* Thu Jun 16 2022 Neal Gompa <ngompa@fedoraproject.org> - 22.2-2
- Add dhcp-client dependency for Azure and OCI network bootstrap
* Thu May 19 2022 Neal Gompa <ngompa@fedoraproject.org> - 22.2-1
- Rebase to 22.2
* Thu Mar 10 2022 Dusty Mabe <dusty@dustymabe.com> - 22.1-3
- Don't require NetworkManager-config-server
* Tue Feb 22 2022 Neal Gompa <ngompa@fedoraproject.org> - 22.1-2
- Drop extra tests search in prep
* Tue Feb 22 2022 Neal Gompa <ngompa@fedoraproject.org> - 22.1-1
- Rebase to 22.1
- Backport cloud-init PR to add proper NetworkManager support
- Add patch to prefer NetworkManager
* Wed Feb 16 2022 Charalampos Stratakis <cstratak@redhat.com> - 21.3-6
- Remove redundant dependencies on nose and mock