20a859
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
20a859
%{!?license: %global license %%doc}
20a859
20a859
# The only reason we are archful is because dmidecode is ExclusiveArch
20a859
# https://bugzilla.redhat.com/show_bug.cgi?id=1067089
20a859
%global debug_package %{nil}
20a859
20a859
Name:           cloud-init
df923a
Version:        18.2
750655
Release:        1%{?dist}.2
20a859
Summary:        Cloud instance init scripts
20a859
20a859
Group:          System Environment/Base
20a859
License:        GPLv3
20a859
URL:            http://launchpad.net/cloud-init
20a859
Source0:        https://launchpad.net/cloud-init/trunk/%{version}/+download/%{name}-%{version}.tar.gz
df923a
Source1:        cloud-init-tmpfiles.conf
df923a
df923a
Patch0001: 0001-Add-initial-redhat-setup.patch
df923a
Patch0002: 0002-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch
df923a
Patch0003: 0003-limit-permissions-on-def_log_file.patch
df923a
Patch0004: 0004-remove-tee-command-from-logging-configuration.patch
df923a
Patch0005: 0005-add-power-state-change-module-to-cloud_final_modules.patch
df923a
Patch0006: 0006-azure-ensure-that-networkmanager-hook-script-runs.patch
df923a
Patch0007: 0007-sysconfig-Don-t-write-BOOTPROTO-dhcp-for-ipv6-dhcp.patch
df923a
Patch0008: 0008-DataSourceAzure.py-use-hostnamectl-to-set-hostname.patch
df923a
Patch0009: 0009-sysconfig-Don-t-disable-IPV6_AUTOCONF.patch
8f0b40
# For bz#1633282 - [Azure] cloud-init fails to mount /dev/sdb1 after stop(deallocate)&&start VM
8f0b40
Patch10: ci-Adding-systemd-mount-options-to-wait-for-cloud-init.patch
8f0b40
# For bz#1633282 - [Azure] cloud-init fails to mount /dev/sdb1 after stop(deallocate)&&start VM
8f0b40
Patch11: ci-Azure-Ignore-NTFS-mount-errors-when-checking-ephemer.patch
8f0b40
# For bz#1633282 - [Azure] cloud-init fails to mount /dev/sdb1 after stop(deallocate)&&start VM
8f0b40
Patch12: ci-azure-Add-reported-ready-marker-file.patch
8f0b40
# For bz#1633282 - [Azure] cloud-init fails to mount /dev/sdb1 after stop(deallocate)&&start VM
8f0b40
Patch13: ci-Adding-disk_setup-to-rhel-cloud.cfg.patch
750655
# For bz#1684038 - EMBARGOED cloud-init: wrong list of ssh keys added to authorized_keys [rhel-7.6.z]
750655
Patch14: ci-azure-Filter-list-of-ssh-keys-pulled-from-fabric.patch
20a859
20a859
# Deal with noarch -> arch
20a859
# https://bugzilla.redhat.com/show_bug.cgi?id=1067089
20a859
Obsoletes:      cloud-init < 0.7.5-3
20a859
20a859
BuildRequires:  python-devel
df923a
BuildRequires:  python-requests
20a859
BuildRequires:  python-setuptools
df923a
BuildRequires:  python-six
df923a
BuildRequires:  python-yaml
20a859
BuildRequires:  systemd-units
20a859
BuildRequires:  git
20a859
20a859
%ifarch %{?ix86} x86_64 ia64
20a859
Requires:       dmidecode
20a859
%endif
20a859
Requires:       e2fsprogs
20a859
Requires:       iproute
20a859
Requires:       libselinux-python
20a859
Requires:       net-tools
20a859
Requires:       policycoreutils-python
20a859
Requires:       procps
20a859
Requires:       python-configobj
20a859
Requires:       python-jinja2
20a859
Requires:       python-jsonpatch
20a859
Requires:       python-prettytable
20a859
Requires:       python-requests
20a859
Requires:       python-setuptools
df923a
Requires:       python-six
20a859
Requires:       PyYAML
20a859
Requires:       pyserial
20a859
Requires:       shadow-utils
20a859
Requires(post):   systemd-units
20a859
Requires(preun):  systemd-units
20a859
Requires(postun): systemd-units
20a859
20a859
%description
20a859
Cloud-init is a set of init scripts for cloud instances.  Cloud instances
20a859
need special scripts to run during initialization to retrieve and install
20a859
ssh keys and to let the user run various scripts.
20a859
20a859
20a859
%prep
20a859
# on el7, autosetup -S git was failing with patches that
df923a
# # create new files.  rpm 4.11.3 and later has -S git_am, but
df923a
# # el7 only has 4.11.1.
20a859
%autosetup -p1 -n %{name}-%{version} -S git
20a859
20a859
%build
20a859
%{__python} setup.py build
20a859
20a859
20a859
%install
20a859
rm -rf $RPM_BUILD_ROOT
20a859
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
20a859
20a859
# Don't ship the tests
df923a
#rm -r $RPM_BUILD_ROOT%{python_sitelib}/tests
20a859
20a859
mkdir -p $RPM_BUILD_ROOT/var/lib/cloud
20a859
20a859
# /run/cloud-init needs a tmpfiles.d entry
20a859
mkdir -p $RPM_BUILD_ROOT/run/cloud-init
20a859
mkdir -p $RPM_BUILD_ROOT/%{_tmpfilesdir}
20a859
cp -p rhel/cloud-init-tmpfiles.conf $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf
20a859
20a859
# We supply our own config file since our software differs from Ubuntu's.
20a859
cp -p rhel/cloud.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg
20a859
20a859
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d
20a859
cp -p tools/21-cloudinit.conf $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf
20a859
20a859
# Make installed NetworkManager hook name less generic
20a859
mv $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d/hook-network-manager \
20a859
   $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d/cloud-init-azure-hook
20a859
20a859
# Install our own systemd units (rhbz#1440831)
20a859
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
20a859
cp rhel/systemd/* $RPM_BUILD_ROOT%{_unitdir}/
20a859
20a859
20a859
%clean
20a859
rm -rf $RPM_BUILD_ROOT
20a859
20a859
20a859
%post
20a859
if [ $1 -eq 1 ] ; then
20a859
    # Initial installation
20a859
    # Enabled by default per "runs once then goes away" exception
20a859
    /bin/systemctl enable cloud-config.service     >/dev/null 2>&1 || :
20a859
    /bin/systemctl enable cloud-final.service      >/dev/null 2>&1 || :
20a859
    /bin/systemctl enable cloud-init.service       >/dev/null 2>&1 || :
20a859
    /bin/systemctl enable cloud-init-local.service >/dev/null 2>&1 || :
3956c3
elif [ $1 -eq 2 ]; then
3956c3
    # Upgrade. If the upgrade is from a version older than 0.7.9-8,
3956c3
    # there will be stale systemd config
3956c3
    /bin/systemctl is-enabled cloud-config.service >/dev/null 2>&1 &&
3956c3
      /bin/systemctl reenable cloud-config.service >/dev/null 2>&1 || :
3956c3
3956c3
    /bin/systemctl is-enabled cloud-final.service >/dev/null 2>&1 &&
3956c3
      /bin/systemctl reenable cloud-final.service >/dev/null 2>&1 || :
3956c3
3956c3
    /bin/systemctl is-enabled cloud-init.service >/dev/null 2>&1 &&
3956c3
      /bin/systemctl reenable cloud-init.service >/dev/null 2>&1 || :
3956c3
3956c3
    /bin/systemctl is-enabled cloud-init-local.service >/dev/null 2>&1 &&
3956c3
      /bin/systemctl reenable cloud-init-local.service >/dev/null 2>&1 || :
20a859
fi
20a859
20a859
%preun
20a859
if [ $1 -eq 0 ] ; then
20a859
    # Package removal, not upgrade
20a859
    /bin/systemctl --no-reload disable cloud-config.service >/dev/null 2>&1 || :
20a859
    /bin/systemctl --no-reload disable cloud-final.service  >/dev/null 2>&1 || :
20a859
    /bin/systemctl --no-reload disable cloud-init.service   >/dev/null 2>&1 || :
20a859
    /bin/systemctl --no-reload disable cloud-init-local.service >/dev/null 2>&1 || :
20a859
    # One-shot services -> no need to stop
20a859
fi
20a859
20a859
%postun
20a859
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
20a859
# One-shot services -> no need to restart
20a859
20a859
20a859
%files
20a859
%license LICENSE
20a859
%doc ChangeLog rhel/README.rhel
20a859
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
20a859
%dir               %{_sysconfdir}/cloud/cloud.cfg.d
20a859
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg
20a859
%doc               %{_sysconfdir}/cloud/cloud.cfg.d/README
20a859
%dir               %{_sysconfdir}/cloud/templates
20a859
%config(noreplace) %{_sysconfdir}/cloud/templates/*
20a859
%{_unitdir}/cloud-config.service
20a859
%{_unitdir}/cloud-config.target
20a859
%{_unitdir}/cloud-final.service
20a859
%{_unitdir}/cloud-init-local.service
20a859
%{_unitdir}/cloud-init.service
20a859
%{_tmpfilesdir}/%{name}.conf
20a859
%{python_sitelib}/*
20a859
%{_libexecdir}/%{name}
20a859
%{_bindir}/cloud-init*
20a859
%doc %{_datadir}/doc/%{name}
20a859
%dir /run/cloud-init
20a859
%dir /var/lib/cloud
20a859
/etc/NetworkManager/dispatcher.d/cloud-init-azure-hook
20a859
%{_udevrulesdir}/66-azure-ephemeral.rules
20a859
20a859
%dir %{_sysconfdir}/rsyslog.d
20a859
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
20a859
20a859
%changelog
750655
* Thu Mar 07 2019 Miroslav Rezanina <mrezanin@redhat.com> - 18.2-1.el7_6.2
750655
- ci-azure-Filter-list-of-ssh-keys-pulled-from-fabric.patch [bz#1684038]
750655
- Resolves: bz#1684038
750655
  (EMBARGOED cloud-init: wrong list of ssh keys added to authorized_keys [rhel-7.6.z])
750655
8f0b40
* Thu Sep 27 2018 Miroslav Rezanina <mrezanin@redhat.com> - 18.2-1.el7_6.1
8f0b40
- ci-Adding-systemd-mount-options-to-wait-for-cloud-init.patch [bz#1633282]
8f0b40
- ci-Azure-Ignore-NTFS-mount-errors-when-checking-ephemer.patch [bz#1633282]
8f0b40
- ci-azure-Add-reported-ready-marker-file.patch [bz#1633282]
8f0b40
- ci-Adding-disk_setup-to-rhel-cloud.cfg.patch [bz#1633282]
8f0b40
- Resolves: bz#1633282
8f0b40
  ([Azure] cloud-init fails to mount /dev/sdb1 after stop(deallocate)&&start VM)
8f0b40
df923a
* Thu Jun 21 2018 Miroslav Rezanina <mrezanin@redhat.com>
df923a
- Rebase to 18.2
df923a
  Resolves: rhbz#1525267
6e9e77
3956c3
* Tue Feb 13 2018 Ryan McCabe <rmccabe@redhat.com> 0.7.9-24
3956c3
- Set DHCP_HOSTNAME on Azure to allow for the hostname to be
3956c3
  published correctly when bouncing the network.
3956c3
  Resolves: rhbz#1434109
3956c3
3956c3
* Mon Jan 15 2018 Ryan McCabe <rmccabe@redhat.com> 0.7.9-23
3956c3
- Fix a bug tha caused cloud-init to fail as a result of trying
3956c3
  to rename bonds.
3956c3
  Resolves: rhbz#1512247
3956c3
3956c3
* Mon Jan 15 2018 Ryan McCabe <rmccabe@redhat.com> 0.7.9-22
3956c3
- Apply patch from -21
3956c3
  Resolves: rhbz#1489270
3956c3
3956c3
* Mon Jan 15 2018 Ryan McCabe <rmccabe@redhat.com> 0.7.9-21
3956c3
- sysconfig: Fix a potential traceback introduced in the
3956c3
  0.7.9-17 build
3956c3
  Resolves: rhbz#1489270
3956c3
3956c3
* Sun Dec 17 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-20
3956c3
- sysconfig: Correct rendering for dhcp on ipv6
3956c3
  Resolves: rhbz#1519271
7fc49f
3956c3
* Thu Nov 30 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-19
7fc49f
- sysconfig: Fix rendering of default gateway for ipv6
3956c3
  Resolves: rhbz#1492726
7fc49f
3956c3
* Fri Nov 24 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-18
3956c3
- Start the cloud-init init local service after the dbus socket is created
3956c3
  so that the hostnamectl command works.
3956c3
  Resolves: rhbz#1450521
7fc49f
3956c3
* Tue Nov 21 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-17
3956c3
- Correctly render DNS and DOMAIN for sysconfig
3956c3
  Resolves: rhbz#1489270
3956c3
3956c3
* Mon Nov 20 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-16
7fc49f
- Disable NetworkManager management of resolv.conf if nameservers
7fc49f
  are specified by configuration.
3956c3
  Resolves: rhbz#1454491
3956c3
3956c3
* Mon Nov 13 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-15
3956c3
- Fix a null reference error in the rh_subscription module
3956c3
  Resolves: rhbz#1498974
7fc49f
3956c3
* Mon Nov 13 2017 Ryan McCabe <rmccabe@redhat.com> 0-7.9-14
3956c3
- Include gateway if it's included in subnet configration
3956c3
  Resolves: rhbz#1492726
3956c3
3956c3
* Sun Nov 12 2017 Ryan McCabe <rmccabe@redhat.com> 0-7.9-13
3956c3
- Do proper cleanup of systemd units when upgrading from versions
3956c3
  0.7.9-3 through 0.7.9-8.
3956c3
  Resolves: rhbz#1465730
3956c3
3956c3
* Thu Nov 09 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-12
20a859
- Prevent Azure NM and dhclient hooks from running when cloud-init is
3956c3
  disabled (rhbz#1474226)
3956c3
3956c3
* Tue Oct 31 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-11
3956c3
- Fix rendering of multiple static IPs per interface file
3956c3
  Resolves: rhbz#bz1497954
20a859
3956c3
* Tue Sep 26 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-10
3956c3
- AliCloud: Add support for the Alibaba Cloud datasource (rhbz#1482547)
20a859
20a859
* Thu Jun 22 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-9
20a859
- RHEL/CentOS: Fix default routes for IPv4/IPv6 configuration. (rhbz#1438082)
20a859
- azure: ensure that networkmanager hook script runs (rhbz#1440831 rhbz#1460206)
20a859
- Fix ipv6 subnet detection (rhbz#1438082)
20a859
20a859
* Tue May 23 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-8
20a859
- Update patches
20a859
20a859
* Mon May 22 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-7
20a859
- Add missing sysconfig unit test data (rhbz#1438082)
20a859
- Fix dual stack IPv4/IPv6 configuration for RHEL (rhbz#1438082)
20a859
- sysconfig: Raise ValueError when multiple default gateways are present. (rhbz#1438082)
20a859
- Bounce network interface for Azure when using the built-in path. (rhbz#1434109)
20a859
- Do not write NM_CONTROLLED=no in generated interface config files (rhbz#1385172)
20a859
20a859
* Wed May 10 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-6
20a859
- add power-state-change module to cloud_final_modules (rhbz#1252477)
20a859
- remove 'tee' command from logging configuration (rhbz#1424612)
20a859
- limit permissions on def_log_file (rhbz#1424612)
20a859
- Bounce network interface for Azure when using the built-in path. (rhbz#1434109)
20a859
- OpenStack: add 'dvs' to the list of physical link types. (rhbz#1442783)
20a859
20a859
* Wed May 10 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-5
20a859
- systemd: replace generator with unit conditionals (rhbz#1440831)
20a859
20a859
* Thu Apr 13 2017 Charalampos Stratakis <cstratak@redhat.com> 0.7.9-4
20a859
- Import to RHEL 7
20a859
Resolves: rhbz#1427280
20a859
20a859
* Tue Mar 07 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-3
20a859
- fixes for network config generation
20a859
- avoid dependency cycle at boot (rhbz#1420946)
20a859
20a859
* Tue Jan 17 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-2
20a859
- use timeout from datasource config in openstack get_data (rhbz#1408589)
20a859
20a859
* Thu Dec 01 2016 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.9-1
20a859
- Rebased on upstream 0.7.9.
20a859
- Remove dependency on run-parts
20a859
20a859
* Wed Jan 06 2016 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-8
20a859
- make rh_subscription plugin do nothing in the absence of a valid
20a859
  configuration [RH:1295953]
20a859
- move rh_subscription module to cloud_config stage
20a859
20a859
* Wed Jan 06 2016 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-7
20a859
- correct permissions on /etc/ssh/sshd_config [RH:1296191]
20a859
20a859
* Thu Sep 03 2015 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-6
20a859
- rebuild for ppc64le
20a859
20a859
* Tue Jul 07 2015 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-5
20a859
- bump revision for new build
20a859
20a859
* Tue Jul 07 2015 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-4
20a859
- ensure rh_subscription plugin is enabled by default
20a859
20a859
* Wed Apr 29 2015 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-3
20a859
- added dependency on python-jinja2 [RH:1215913]
20a859
- added rhn_subscription plugin [RH:1227393]
20a859
- require pyserial to support smartos data source [RH:1226187]
20a859
20a859
* Fri Jan 16 2015 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-2
20a859
- Rebased RHEL version to Fedora rawhide
20a859
- Backported fix for https://bugs.launchpad.net/cloud-init/+bug/1246485
20a859
- Backported fix for https://bugs.launchpad.net/cloud-init/+bug/1411829
20a859
20a859
* Fri Nov 14 2014 Colin Walters <walters@redhat.com> - 0.7.6-1
20a859
- New upstream version [RH:974327]
20a859
- Drop python-cheetah dependency (same as above bug)