ef3f20
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
ef3f20
%{!?license: %global license %%doc}
ef3f20
ef3f20
# The only reason we are archful is because dmidecode is ExclusiveArch
ef3f20
# https://bugzilla.redhat.com/show_bug.cgi?id=1067089
ef3f20
%global debug_package %{nil}
ef3f20
ef3f20
Name:           cloud-init
ef3f20
Version:        0.7.9
1064ba
Release:        24%{?dist}
ef3f20
Summary:        Cloud instance init scripts
ef3f20
ef3f20
Group:          System Environment/Base
ef3f20
License:        GPLv3
ef3f20
URL:            http://launchpad.net/cloud-init
ef3f20
Source0:        https://launchpad.net/cloud-init/trunk/%{version}/+download/%{name}-%{version}.tar.gz
ef3f20
Source1:        cloud-init-rhel.cfg
ef3f20
Source2:        cloud-init-README.rhel
ef3f20
Source3:        cloud-init-tmpfiles.conf
ef3f20
ef3f20
# The following line stops 'rdopkg update-patches' from inserting Patch
ef3f20
# directives in the middle of our Source directives.
ef3f20
#
ef3f20
# patches_base=0.7.9
ef3f20
Patch0001: 0001-configuration-changes-for-RHEL-package.patch
ef3f20
Patch0002: 0002-do-not-use-git-to-determine-version.patch
ef3f20
Patch0003: 0003-util-teach-write_file-about-copy_mode-option.patch
ef3f20
Patch0004: 0004-Do-not-write-NM_CONTROLLED-no-in-generated-interface.patch
ef3f20
Patch0005: 0005-url_helper-fail-gracefully-if-oauthlib-is-not-availa.patch
ef3f20
Patch0006: 0006-rsyslog-replace-with-stop.patch
ef3f20
Patch0007: 0007-OpenStack-Use-timeout-and-retries-from-config-in-get.patch
ef3f20
Patch0008: 0008-correct-errors-in-cloudinit-net-sysconfig.py.patch
ef3f20
Patch0009: 0009-net-do-not-raise-exception-for-3-nameservers.patch
ef3f20
Patch0010: 0010-net-support-both-ipv4-and-ipv6-gateways-in-sysconfig.patch
ef3f20
Patch0011: 0011-systemd-replace-generator-with-unit-conditionals.patch
ef3f20
Patch0012: 0012-OpenStack-add-dvs-to-the-list-of-physical-link-types.patch
ef3f20
Patch0013: 0013-Bounce-network-interface-for-Azure-when-using-the-bu.patch
ef3f20
Patch0014: 0014-limit-permissions-on-def_log_file.patch
ef3f20
Patch0015: 0015-remove-tee-command-from-logging-configuration.patch
ef3f20
Patch0016: 0016-add-power-state-change-module-to-cloud_final_modules.patch
ef3f20
Patch0017: 0017-sysconfig-Raise-ValueError-when-multiple-default-gat.patch
ef3f20
Patch0018: 0018-Fix-dual-stack-IPv4-IPv6-configuration-for-RHEL.patch
ef3f20
Patch0019: 0019-Add-missing-sysconfig-unit-test-data.patch
ef3f20
Patch0020: 0020-Fix-ipv6-subnet-detection.patch
1064ba
# Not applied to work around additional issues related to rhbz#1474226
48a629
#Patch0021: 0021-azure-ensure-that-networkmanager-hook-script-runs.patch
ef3f20
Patch0022: 0022-RHEL-CentOS-Fix-default-routes-for-IPv4-IPv6-configu.patch
bfa931
Patch0023: 0023-DatasourceEc2-add-warning-message-when-not-on-AWS.patch
bfa931
Patch0024: 0024-Identify-Brightbox-as-an-Ec2-datasource-user.patch
bfa931
Patch0025: 0025-AliYun-Enable-platform-identification-and-enable-by-.patch
bfa931
Patch0026: 0026-Fix-alibaba-cloud-unit-tests-to-work-with-0.7.9.patch
1064ba
Patch0027: 0027-Fix-eni-rendering-of-multiple-IPs-per-interface.patch
1064ba
Patch0028: 0028-systemd-create-run-cloud-init-enabled.patch
5a2e6e
Patch0029: 0029-support-loopback-as-a-device-type.patch
1064ba
Patch0030: 0030-sysconfig-include-GATEWAY-value-if-set-in-subnet.patch
1064ba
Patch0031: 0031-rh_subscription-Perform-null-checks-for-enabled-and-.patch
1064ba
Patch0032: 0032-net-Allow-for-NetworkManager-configuration.patch
1064ba
Patch0033: 0033-Render-DNS-and-DOMAIN-lines-for-sysconfig.patch
1064ba
Patch0034: 0034-Start_cloud_init_after_dbus.patch
1064ba
Patch0035: 0035-sysconfig-Render-IPV6_DEFAULTGW-correctly.patch
1064ba
Patch0036: 0036-sysconfig-Don-t-write-BOOTPROTO-dhcp-for-ipv6-dhcp.patch
1064ba
Patch0037: 0037-sysconfig-Fix-traceback.patch
1064ba
Patch0038: 0038-Fix-bug-that-resulted-in-an-attempt-to-rename-bonds.patch
1064ba
Patch0039: 0039-azure-Fix-publishing-of-hostname.patch
140f72
Patch9999: cloud-init-add-centos-os.patch
ef3f20
ef3f20
# Deal with noarch -> arch
ef3f20
# https://bugzilla.redhat.com/show_bug.cgi?id=1067089
ef3f20
Obsoletes:      cloud-init < 0.7.5-3
ef3f20
ef3f20
BuildRequires:  python-devel
ef3f20
BuildRequires:  python-setuptools
ef3f20
BuildRequires:  systemd-units
ef3f20
BuildRequires:  git
ef3f20
ef3f20
%ifarch %{?ix86} x86_64 ia64
ef3f20
Requires:       dmidecode
ef3f20
%endif
ef3f20
Requires:       e2fsprogs
ef3f20
Requires:       iproute
ef3f20
Requires:       libselinux-python
ef3f20
Requires:       net-tools
ef3f20
Requires:       policycoreutils-python
ef3f20
Requires:       procps
ef3f20
Requires:       python-configobj
ef3f20
Requires:       python-jinja2
ef3f20
Requires:       python-jsonpatch
ef3f20
Requires:       python-prettytable
ef3f20
Requires:       python-requests
ef3f20
Requires:       python-setuptools
ef3f20
Requires:       PyYAML
ef3f20
Requires:       pyserial
ef3f20
Requires:       shadow-utils
ef3f20
Requires(post):   systemd-units
ef3f20
Requires(preun):  systemd-units
ef3f20
Requires(postun): systemd-units
ef3f20
ef3f20
%description
ef3f20
Cloud-init is a set of init scripts for cloud instances.  Cloud instances
ef3f20
need special scripts to run during initialization to retrieve and install
ef3f20
ssh keys and to let the user run various scripts.
ef3f20
ef3f20
ef3f20
%prep
ef3f20
# on el7, autosetup -S git was failing with patches that
ef3f20
# create new files.  rpm 4.11.3 and later has -S git_am, but
ef3f20
# el7 only has 4.11.1.
ef3f20
%autosetup -p1 -n %{name}-%{version} -S git
ef3f20
ef3f20
ef3f20
%build
ef3f20
%{__python} setup.py build
ef3f20
ef3f20
ef3f20
%install
ef3f20
rm -rf $RPM_BUILD_ROOT
ef3f20
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
ef3f20
ef3f20
# Don't ship the tests
ef3f20
rm -r $RPM_BUILD_ROOT%{python_sitelib}/tests
ef3f20
ef3f20
mkdir -p $RPM_BUILD_ROOT/var/lib/cloud
ef3f20
ef3f20
# /run/cloud-init needs a tmpfiles.d entry
ef3f20
mkdir -p $RPM_BUILD_ROOT/run/cloud-init
ef3f20
mkdir -p $RPM_BUILD_ROOT/%{_tmpfilesdir}
ef3f20
cp -p rhel/cloud-init-tmpfiles.conf $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf
ef3f20
ef3f20
# We supply our own config file since our software differs from Ubuntu's.
ef3f20
cp -p rhel/cloud.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg
ef3f20
ef3f20
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d
ef3f20
cp -p tools/21-cloudinit.conf $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf
ef3f20
ef3f20
# Make installed NetworkManager hook name less generic
ef3f20
mv $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d/hook-network-manager \
ef3f20
   $RPM_BUILD_ROOT/etc/NetworkManager/dispatcher.d/cloud-init-azure-hook
ef3f20
ef3f20
# Install our own systemd units (rhbz#1440831)
ef3f20
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
ef3f20
cp rhel/systemd/* $RPM_BUILD_ROOT%{_unitdir}/
ef3f20
ef3f20
ef3f20
%clean
ef3f20
rm -rf $RPM_BUILD_ROOT
ef3f20
ef3f20
ef3f20
%post
ef3f20
if [ $1 -eq 1 ] ; then
ef3f20
    # Initial installation
ef3f20
    # Enabled by default per "runs once then goes away" exception
ef3f20
    /bin/systemctl enable cloud-config.service     >/dev/null 2>&1 || :
ef3f20
    /bin/systemctl enable cloud-final.service      >/dev/null 2>&1 || :
ef3f20
    /bin/systemctl enable cloud-init.service       >/dev/null 2>&1 || :
ef3f20
    /bin/systemctl enable cloud-init-local.service >/dev/null 2>&1 || :
1064ba
elif [ $1 -eq 2 ]; then
1064ba
    # Upgrade. If the upgrade is from a version older than 0.7.9-8,
1064ba
    # there will be stale systemd config
1064ba
    /bin/systemctl is-enabled cloud-config.service >/dev/null 2>&1 &&
1064ba
      /bin/systemctl reenable cloud-config.service >/dev/null 2>&1 || :
1064ba
1064ba
    /bin/systemctl is-enabled cloud-final.service >/dev/null 2>&1 &&
1064ba
      /bin/systemctl reenable cloud-final.service >/dev/null 2>&1 || :
1064ba
1064ba
    /bin/systemctl is-enabled cloud-init.service >/dev/null 2>&1 &&
1064ba
      /bin/systemctl reenable cloud-init.service >/dev/null 2>&1 || :
1064ba
1064ba
    /bin/systemctl is-enabled cloud-init-local.service >/dev/null 2>&1 &&
1064ba
      /bin/systemctl reenable cloud-init-local.service >/dev/null 2>&1 || :
ef3f20
fi
ef3f20
ef3f20
%preun
ef3f20
if [ $1 -eq 0 ] ; then
ef3f20
    # Package removal, not upgrade
ef3f20
    /bin/systemctl --no-reload disable cloud-config.service >/dev/null 2>&1 || :
ef3f20
    /bin/systemctl --no-reload disable cloud-final.service  >/dev/null 2>&1 || :
ef3f20
    /bin/systemctl --no-reload disable cloud-init.service   >/dev/null 2>&1 || :
ef3f20
    /bin/systemctl --no-reload disable cloud-init-local.service >/dev/null 2>&1 || :
ef3f20
    # One-shot services -> no need to stop
ef3f20
fi
ef3f20
ef3f20
%postun
ef3f20
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
ef3f20
# One-shot services -> no need to restart
ef3f20
ef3f20
ef3f20
%files
ef3f20
%license LICENSE
ef3f20
%doc ChangeLog rhel/README.rhel
ef3f20
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
ef3f20
%dir               %{_sysconfdir}/cloud/cloud.cfg.d
ef3f20
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg
ef3f20
%doc               %{_sysconfdir}/cloud/cloud.cfg.d/README
ef3f20
%dir               %{_sysconfdir}/cloud/templates
ef3f20
%config(noreplace) %{_sysconfdir}/cloud/templates/*
ef3f20
%{_unitdir}/cloud-config.service
ef3f20
%{_unitdir}/cloud-config.target
ef3f20
%{_unitdir}/cloud-final.service
ef3f20
%{_unitdir}/cloud-init-local.service
ef3f20
%{_unitdir}/cloud-init.service
ef3f20
%{_tmpfilesdir}/%{name}.conf
ef3f20
%{python_sitelib}/*
ef3f20
%{_libexecdir}/%{name}
ef3f20
%{_bindir}/cloud-init*
ef3f20
%doc %{_datadir}/doc/%{name}
ef3f20
%dir /run/cloud-init
ef3f20
%dir /var/lib/cloud
ef3f20
/etc/NetworkManager/dispatcher.d/cloud-init-azure-hook
ef3f20
%{_udevrulesdir}/66-azure-ephemeral.rules
ef3f20
ef3f20
%dir %{_sysconfdir}/rsyslog.d
ef3f20
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
ef3f20
ef3f20
%changelog
140f72
* Wed Apr 11 2018 Johnny Hughes <johnny@centos.org> 0.7.9-24
140f72
- Manual CentOS Debranding
140f72
1064ba
* Tue Feb 13 2018 Ryan McCabe <rmccabe@redhat.com> 0.7.9-24
1064ba
- Set DHCP_HOSTNAME on Azure to allow for the hostname to be
1064ba
  published correctly when bouncing the network.
1064ba
  Resolves: rhbz#1434109
1064ba
1064ba
* Mon Jan 15 2018 Ryan McCabe <rmccabe@redhat.com> 0.7.9-23
1064ba
- Fix a bug tha caused cloud-init to fail as a result of trying
1064ba
  to rename bonds.
1064ba
  Resolves: rhbz#1512247
1064ba
1064ba
* Mon Jan 15 2018 Ryan McCabe <rmccabe@redhat.com> 0.7.9-22
1064ba
- Apply patch from -21
1064ba
  Resolves: rhbz#1489270
1064ba
1064ba
* Mon Jan 15 2018 Ryan McCabe <rmccabe@redhat.com> 0.7.9-21
1064ba
- sysconfig: Fix a potential traceback introduced in the
1064ba
  0.7.9-17 build
1064ba
  Resolves: rhbz#1489270
1064ba
1064ba
* Sun Dec 17 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-20
1064ba
- sysconfig: Correct rendering for dhcp on ipv6
1064ba
  Resolves: rhbz#1519271
5a2e6e
1064ba
* Thu Nov 30 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-19
5a2e6e
- sysconfig: Fix rendering of default gateway for ipv6
1064ba
  Resolves: rhbz#1492726
5a2e6e
1064ba
* Fri Nov 24 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-18
1064ba
- Start the cloud-init init local service after the dbus socket is created
1064ba
  so that the hostnamectl command works.
1064ba
  Resolves: rhbz#1450521
5a2e6e
1064ba
* Tue Nov 21 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-17
1064ba
- Correctly render DNS and DOMAIN for sysconfig
1064ba
  Resolves: rhbz#1489270
1064ba
1064ba
* Mon Nov 20 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-16
5a2e6e
- Disable NetworkManager management of resolv.conf if nameservers
5a2e6e
  are specified by configuration.
1064ba
  Resolves: rhbz#1454491
1064ba
1064ba
* Mon Nov 13 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-15
1064ba
- Fix a null reference error in the rh_subscription module
1064ba
  Resolves: rhbz#1498974
7ecf9d
1064ba
* Mon Nov 13 2017 Ryan McCabe <rmccabe@redhat.com> 0-7.9-14
1064ba
- Include gateway if it's included in subnet configration
1064ba
  Resolves: rhbz#1492726
1064ba
1064ba
* Sun Nov 12 2017 Ryan McCabe <rmccabe@redhat.com> 0-7.9-13
1064ba
- Do proper cleanup of systemd units when upgrading from versions
1064ba
  0.7.9-3 through 0.7.9-8.
1064ba
  Resolves: rhbz#1465730
1064ba
1064ba
* Thu Nov 09 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-12
48a629
- Prevent Azure NM and dhclient hooks from running when cloud-init is
1064ba
  disabled (rhbz#1474226)
1064ba
1064ba
* Tue Oct 31 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-11
1064ba
- Fix rendering of multiple static IPs per interface file
1064ba
  Resolves: rhbz#bz1497954
48a629
1064ba
* Tue Sep 26 2017 Ryan McCabe <rmccabe@redhat.com> 0.7.9-10
1064ba
- AliCloud: Add support for the Alibaba Cloud datasource (rhbz#1482547)
Karanbir Singh 0a9171
ef3f20
* Thu Jun 22 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-9
ef3f20
- RHEL/CentOS: Fix default routes for IPv4/IPv6 configuration. (rhbz#1438082)
ef3f20
- azure: ensure that networkmanager hook script runs (rhbz#1440831 rhbz#1460206)
ef3f20
- Fix ipv6 subnet detection (rhbz#1438082)
ef3f20
ef3f20
* Tue May 23 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-8
ef3f20
- Update patches
ef3f20
ef3f20
* Mon May 22 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-7
ef3f20
- Add missing sysconfig unit test data (rhbz#1438082)
ef3f20
- Fix dual stack IPv4/IPv6 configuration for RHEL (rhbz#1438082)
ef3f20
- sysconfig: Raise ValueError when multiple default gateways are present. (rhbz#1438082)
ef3f20
- Bounce network interface for Azure when using the built-in path. (rhbz#1434109)
ef3f20
- Do not write NM_CONTROLLED=no in generated interface config files (rhbz#1385172)
ef3f20
ef3f20
* Wed May 10 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-6
ef3f20
- add power-state-change module to cloud_final_modules (rhbz#1252477)
ef3f20
- remove 'tee' command from logging configuration (rhbz#1424612)
ef3f20
- limit permissions on def_log_file (rhbz#1424612)
ef3f20
- Bounce network interface for Azure when using the built-in path. (rhbz#1434109)
ef3f20
- OpenStack: add 'dvs' to the list of physical link types. (rhbz#1442783)
ef3f20
ef3f20
* Wed May 10 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-5
ef3f20
- systemd: replace generator with unit conditionals (rhbz#1440831)
ef3f20
ef3f20
* Thu Apr 13 2017 Charalampos Stratakis <cstratak@redhat.com> 0.7.9-4
ef3f20
- Import to RHEL 7
ef3f20
Resolves: rhbz#1427280
ef3f20
ef3f20
* Tue Mar 07 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-3
ef3f20
- fixes for network config generation
ef3f20
- avoid dependency cycle at boot (rhbz#1420946)
ef3f20
ef3f20
* Tue Jan 17 2017 Lars Kellogg-Stedman <lars@redhat.com> 0.7.9-2
ef3f20
- use timeout from datasource config in openstack get_data (rhbz#1408589)
ef3f20
ef3f20
* Thu Dec 01 2016 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.9-1
ef3f20
- Rebased on upstream 0.7.9.
ef3f20
- Remove dependency on run-parts
ef3f20
ef3f20
* Wed Jan 06 2016 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-8
ef3f20
- make rh_subscription plugin do nothing in the absence of a valid
ef3f20
  configuration [RH:1295953]
ef3f20
- move rh_subscription module to cloud_config stage
ef3f20
ef3f20
* Wed Jan 06 2016 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-7
ef3f20
- correct permissions on /etc/ssh/sshd_config [RH:1296191]
ef3f20
ef3f20
* Thu Sep 03 2015 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-6
ef3f20
- rebuild for ppc64le
ef3f20
ef3f20
* Tue Jul 07 2015 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-5
ef3f20
- bump revision for new build
ef3f20
ef3f20
* Tue Jul 07 2015 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-4
ef3f20
- ensure rh_subscription plugin is enabled by default
ef3f20
ef3f20
* Wed Apr 29 2015 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-3
ef3f20
- added dependency on python-jinja2 [RH:1215913]
ef3f20
- added rhn_subscription plugin [RH:1227393]
ef3f20
- require pyserial to support smartos data source [RH:1226187]
ef3f20
ef3f20
* Fri Jan 16 2015 Lars Kellogg-Stedman <lars@redhat.com> - 0.7.6-2
ef3f20
- Rebased RHEL version to Fedora rawhide
ef3f20
- Backported fix for https://bugs.launchpad.net/cloud-init/+bug/1246485
ef3f20
- Backported fix for https://bugs.launchpad.net/cloud-init/+bug/1411829
ef3f20
ef3f20
* Fri Nov 14 2014 Colin Walters <walters@redhat.com> - 0.7.6-1
ef3f20
- New upstream version [RH:974327]
ef3f20
- Drop python-cheetah dependency (same as above bug)