d3c36a
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
d3c36a
%{!?license: %global license %%doc}
d3c36a
d3c36a
# The only reason we are archful is because dmidecode is ExclusiveArch
d3c36a
# https://bugzilla.redhat.com/show_bug.cgi?id=1067089
d3c36a
%global debug_package %{nil}
d3c36a
d3c36a
Name:           cloud-init
d3c36a
Version:        0.7.5
Karanbir Singh fdbbe7
Release:        10%{?dist}.1
d3c36a
Summary:        Cloud instance init scripts
d3c36a
d3c36a
Group:          System Environment/Base
d3c36a
License:        GPLv3
d3c36a
URL:            http://launchpad.net/cloud-init
d3c36a
Source0:        https://launchpad.net/cloud-init/trunk/%{version}/+download/%{name}-%{version}.tar.gz
Karanbir Singh 017142
Source1:        cloud-init-centos.cfg
d3c36a
Source2:        cloud-init-README.rhel
d3c36a
Source3:        cloud-init-tmpfiles.conf
d3c36a
d3c36a
# Patches managed with rdopkg, using github.com/larsks/cloud-init as integration
d3c36a
# repository.
d3c36a
# patches_base=0.7.5
d3c36a
Patch0001: 0001-update-paths-for-rhel.patch
d3c36a
Patch0002: 0002-fix-rsyslog-programname-match.patch
d3c36a
Patch0003: 0003-Stopped-calling-udevadm-settle-with-quiet-since-syst.patch
d3c36a
Patch0004: 0004-fix-typo-in-settings.py-preventing-metadata-being-fe.patch
d3c36a
Karanbir Singh 2fc45d
Patch1001: cloud-init-centos-opennebula.patch
Karanbir Singh 87012b
Patch1002: cloud-init-centos-hostnamefix.patch
Karanbir Singh 079df3
Patch1003: cloud-init-centos-opennebula-requiretty.patch
Karanbir Singh 079df3
Patch1004: cloud-init-centos-cloudstack-urlhandling.patch
Karanbir Singh 2fc45d
d3c36a
# Deal with noarch -> arch
d3c36a
# https://bugzilla.redhat.com/show_bug.cgi?id=1067089
d3c36a
Obsoletes:      cloud-init < 0.7.5-3
d3c36a
d3c36a
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
d3c36a
d3c36a
BuildRequires:  python-devel
d3c36a
BuildRequires:  python-setuptools
d3c36a
BuildRequires:  systemd-units
d3c36a
%ifarch %{?ix86} x86_64 ia64
d3c36a
Requires:       dmidecode
d3c36a
%endif
d3c36a
Requires:       e2fsprogs
d3c36a
Requires:       iproute
d3c36a
Requires:       libselinux-python
d3c36a
Requires:       net-tools
d3c36a
Requires:       policycoreutils-python
d3c36a
Requires:       procps
d3c36a
Requires:       python-boto
d3c36a
Requires:       python-cheetah
d3c36a
Requires:       python-configobj
d3c36a
Requires:       python-prettytable
d3c36a
Requires:       python-requests
d3c36a
Requires:       PyYAML
d3c36a
Requires:       python-jsonpatch
d3c36a
Requires:       rsyslog
d3c36a
Requires:       shadow-utils
d3c36a
Requires:       /usr/bin/run-parts
d3c36a
Requires(post):   systemd-units
d3c36a
Requires(preun):  systemd-units
d3c36a
Requires(postun): systemd-units
d3c36a
d3c36a
%description
d3c36a
Cloud-init is a set of init scripts for cloud instances.  Cloud instances
d3c36a
need special scripts to run during initialization to retrieve and install
d3c36a
ssh keys and to let the user run various scripts.
d3c36a
d3c36a
d3c36a
%prep
d3c36a
%setup -q -n %{name}-%{version}
d3c36a
d3c36a
%patch0001 -p1
d3c36a
%patch0002 -p1
d3c36a
%patch0003 -p1
d3c36a
%patch0004 -p1
Karanbir Singh 2fc45d
%patch1001 -p1
Karanbir Singh 87012b
%patch1002 -p1
Karanbir Singh 079df3
%patch1003 -p1
Karanbir Singh 079df3
%patch1004 -p1
d3c36a
d3c36a
cp -p %{SOURCE2} README.rhel
d3c36a
d3c36a
d3c36a
%build
d3c36a
%{__python} setup.py build
d3c36a
d3c36a
d3c36a
%install
d3c36a
rm -rf $RPM_BUILD_ROOT
d3c36a
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
d3c36a
d3c36a
# Don't ship the tests
d3c36a
rm -r $RPM_BUILD_ROOT%{python_sitelib}/tests
d3c36a
d3c36a
mkdir -p $RPM_BUILD_ROOT/var/lib/cloud
d3c36a
d3c36a
# /run/cloud-init needs a tmpfiles.d entry
d3c36a
mkdir -p $RPM_BUILD_ROOT/run/cloud-init
d3c36a
mkdir -p         $RPM_BUILD_ROOT/%{_tmpfilesdir}
d3c36a
cp -p %{SOURCE3} $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf
d3c36a
d3c36a
# We supply our own config file since our software differs from Ubuntu's.
d3c36a
cp -p %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg
d3c36a
d3c36a
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d
d3c36a
cp -p tools/21-cloudinit.conf $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf
d3c36a
d3c36a
# Install the systemd bits
d3c36a
mkdir -p         $RPM_BUILD_ROOT/%{_unitdir}
d3c36a
cp -p systemd/*  $RPM_BUILD_ROOT/%{_unitdir}
d3c36a
d3c36a
d3c36a
d3c36a
%clean
d3c36a
rm -rf $RPM_BUILD_ROOT
d3c36a
d3c36a
d3c36a
%post
d3c36a
if [ $1 -eq 1 ] ; then
d3c36a
    # Initial installation
d3c36a
    # Enabled by default per "runs once then goes away" exception
d3c36a
    /bin/systemctl enable cloud-config.service     >/dev/null 2>&1 || :
d3c36a
    /bin/systemctl enable cloud-final.service      >/dev/null 2>&1 || :
d3c36a
    /bin/systemctl enable cloud-init.service       >/dev/null 2>&1 || :
d3c36a
    /bin/systemctl enable cloud-init-local.service >/dev/null 2>&1 || :
d3c36a
fi
d3c36a
d3c36a
%preun
d3c36a
if [ $1 -eq 0 ] ; then
d3c36a
    # Package removal, not upgrade
d3c36a
    /bin/systemctl --no-reload disable cloud-config.service >/dev/null 2>&1 || :
d3c36a
    /bin/systemctl --no-reload disable cloud-final.service  >/dev/null 2>&1 || :
d3c36a
    /bin/systemctl --no-reload disable cloud-init.service   >/dev/null 2>&1 || :
d3c36a
    /bin/systemctl --no-reload disable cloud-init-local.service >/dev/null 2>&1 || :
d3c36a
    # One-shot services -> no need to stop
d3c36a
fi
d3c36a
d3c36a
%postun
d3c36a
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
d3c36a
# One-shot services -> no need to restart
d3c36a
d3c36a
d3c36a
%files
d3c36a
%license LICENSE
d3c36a
%doc ChangeLog TODO README.rhel
d3c36a
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
d3c36a
%dir               %{_sysconfdir}/cloud/cloud.cfg.d
d3c36a
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg
d3c36a
%doc               %{_sysconfdir}/cloud/cloud.cfg.d/README
d3c36a
%dir               %{_sysconfdir}/cloud/templates
d3c36a
%config(noreplace) %{_sysconfdir}/cloud/templates/*
d3c36a
%{_unitdir}/cloud-config.service
d3c36a
%{_unitdir}/cloud-config.target
d3c36a
%{_unitdir}/cloud-final.service
d3c36a
%{_unitdir}/cloud-init-local.service
d3c36a
%{_unitdir}/cloud-init.service
d3c36a
%{_tmpfilesdir}/%{name}.conf
d3c36a
%{python_sitelib}/*
d3c36a
%{_libexecdir}/%{name}
d3c36a
%{_bindir}/cloud-init*
d3c36a
%doc %{_datadir}/doc/%{name}
d3c36a
%dir /run/cloud-init
d3c36a
%dir /var/lib/cloud
d3c36a
d3c36a
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
d3c36a
d3c36a
d3c36a
%changelog
Karanbir Singh fdbbe7
* Wed Sep 10 2014 Karanbir Singh <kbsingh@centos.org> 0.7.5-10.el7.centos.1
Karanbir Singh fdbbe7
- Bump release to prevent flapping with EPEL package
Karanbir Singh fdbbe7
Karanbir Singh 079df3
* Fri Aug 29 2014 Karanbir Singh <kbsingh@centos.org> 0.7.5-2.el7.centos.1
Karanbir Singh 079df3
- Add OpenNebula patch to work with requiretty in sudoers (Jfontan #7543)
Karanbir Singh 079df3
- Add cloudstack url workaround patch (Lucian #7544)
Karanbir Singh 079df3
Karanbir Singh d3f947
* Tue Aug 26 2014 Karanbir Singh <kbsingh@centos.org> 0.7.5-2.el7.centos
Karanbir Singh d3f947
- Bump ver 
Karanbir Singh d3f947
Karanbir Singh 87012b
* Wed Aug 13 2014 Karanbir Singh <kbsingh@centos.org>
Karanbir Singh 079df3
- add a patch to fix hostname issues ( Thomas Oulevey #7545)
Karanbir Singh 87012b
Karanbir Singh 2fc45d
* Tue Jul 29 2014 Karanbir Singh <kbsingh@centos.org>
Karanbir Singh 079df3
- Upgrade the opennebula datasource (Jfontan #7543)
Karanbir Singh 2fc45d
Karanbir Singh 017142
* Tue Jul 15 2014 Karanbir Singh <kbsingh@centos.org>
Karanbir Singh 017142
- default to using centos as the login id
Karanbir Singh 017142
d3c36a
* Mon Jun 23 2014 Lars Kellogg-Stedman <lars@redhat.com> 0.7.5-1 (redhat)
d3c36a
- Rebased against upstream 0.7.5-6 in order to pull in GCE support.
d3c36a
d3c36a
* Thu Jun 12 2014 Dennis Gilmore <dennis@ausil.us> - 0.7.5-6
d3c36a
- fix typo in settings.py preventing metadata being fecthed in ec2
d3c36a
d3c36a
* Mon Jun  9 2014 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.5-5
d3c36a
- Stopped calling ``udevadm settle'' with --quiet since systemd 213 removed it
d3c36a
d3c36a
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.5-4
d3c36a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
d3c36a
d3c36a
* Mon Jun  2 2014 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.5-3
d3c36a
- Make dmidecode dependency arch-dependent [RH:1025071 RH:1067089]
d3c36a
d3c36a
* Mon Jun  2 2014 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.2-9
d3c36a
- Write /etc/locale.conf instead of /etc/sysconfig/i18n [RH:1008250]
d3c36a
- Add tmpfiles.d configuration for /run/cloud-init [RH:1103761]
d3c36a
- Use the license rpm macro
d3c36a
- BuildRequire python-setuptools, not python-setuptools-devel
d3c36a
d3c36a
* Fri May 30 2014 Matthew Miller <mattdm@fedoraproject.org> - 0.7.5-2
d3c36a
- add missing python-jsonpatch dependency [RH:1103281]
d3c36a
d3c36a
* Tue Apr 29 2014 Sam Kottler <skottler@fedoraproject.org> - 0.7.5-1
d3c36a
- Update to 0.7.5 and remove patches which landed in the release
d3c36a
d3c36a
* Sat Jan 25 2014 Sam Kottler <skottler@fedoraproject.org> - 0.7.2-8
d3c36a
- Remove patch to the Puppet service unit name [RH:1057860]
d3c36a
d3c36a
* Tue Sep 24 2013 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.2-7
d3c36a
- Dropped xfsprogs dependency [RH:974329]
d3c36a
d3c36a
* Tue Sep 24 2013 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.2-6
d3c36a
- Added yum-add-repo module
d3c36a
d3c36a
* Fri Sep 20 2013 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.2-5
d3c36a
- Fixed puppet agent service name [RH:1008250]
d3c36a
- Let systemd handle console output [RH:977952 LP:1228434]
d3c36a
- Fixed restorecon failure when selinux is disabled [RH:967002 LP:1228441]
d3c36a
- Fixed rsyslog log filtering
d3c36a
- Added missing modules [RH:966888]
d3c36a
d3c36a
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.2-4
d3c36a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
d3c36a
d3c36a
* Sat Jun 15 2013 Matthew Miller <mattdm@fedoraproject.org> - 0.7.2-3
d3c36a
- switch ec2-user to "fedora" --  see bugzilla #971439. To use another
d3c36a
  name, use #cloud-config option "users:" in userdata in cloud metadata
d3c36a
  service
d3c36a
- add that user to systemd-journal group
d3c36a
d3c36a
* Fri May 17 2013 Steven Hardy <shardy@redhat.com> - 0.7.2
d3c36a
- Update to the 0.7.2 release
d3c36a
d3c36a
* Thu May 02 2013 Steven Hardy <shardy@redhat.com> - 0.7.2-0.1.bzr809
d3c36a
- Rebased against upstream rev 809, fixes several F18 related issues
d3c36a
- Added dependency on python-requests
d3c36a
d3c36a
* Sat Apr  6 2013 Orion Poplawski <orion@cora.nwra.com> - 0.7.1-4
d3c36a
- Don't ship tests
d3c36a
d3c36a
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.1-3
d3c36a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
d3c36a
d3c36a
* Thu Dec 13 2012 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.1-2
d3c36a
- Added default_user to cloud.cfg (this is required for ssh keys to work)
d3c36a
d3c36a
* Wed Nov 21 2012 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.1-1
d3c36a
- Rebased against version 0.7.1
d3c36a
- Fixed broken sudoers file generation
d3c36a
- Fixed "resize_root: noblock" [LP:1080985]
d3c36a
d3c36a
* Tue Oct  9 2012 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.0-1
d3c36a
- Rebased against version 0.7.0
d3c36a
- Fixed / filesystem resizing
d3c36a
d3c36a
* Sat Sep 22 2012 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.0-0.3.bzr659
d3c36a
- Added dmidecode dependency for DataSourceAltCloud
d3c36a
d3c36a
* Sat Sep 22 2012 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.0-0.2.bzr659
d3c36a
- Rebased against upstream rev 659
d3c36a
- Fixed hostname persistence
d3c36a
- Fixed ssh key printing
d3c36a
- Fixed sudoers file permissions
d3c36a
d3c36a
* Mon Sep 17 2012 Garrett Holmstrom <gholms@fedoraproject.org> - 0.7.0-0.1.bzr650
d3c36a
- Rebased against upstream rev 650
d3c36a
- Added support for useradd --selinux-user
d3c36a
d3c36a
* Thu Sep 13 2012 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.3-0.5.bzr532
d3c36a
- Use a FQDN (instance-data.) for instance data URL fallback [RH:850916 LP:1040200]
d3c36a
- Shut off systemd timeouts [RH:836269]
d3c36a
- Send output to the console [RH:854654]
d3c36a
d3c36a
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.3-0.4.bzr532
d3c36a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
d3c36a
d3c36a
* Wed Jun 27 2012 Pádraig Brady <P@draigBrady.com> - 0.6.3-0.3.bzr532
d3c36a
- Add support for installing yum packages
d3c36a
d3c36a
* Sat Mar 31 2012 Andy Grimm <agrimm@gmail.com> - 0.6.3-0.2.bzr532
d3c36a
- Fixed incorrect interpretation of relative path for
d3c36a
  AuthorizedKeysFile (BZ #735521)
d3c36a
d3c36a
* Mon Mar  5 2012 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.3-0.1.bzr532
d3c36a
- Rebased against upstream rev 532
d3c36a
- Fixed runparts() incompatibility with Fedora
d3c36a
d3c36a
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.2-0.8.bzr457
d3c36a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
d3c36a
d3c36a
* Wed Oct  5 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.7.bzr457
d3c36a
- Disabled SSH key-deleting on startup
d3c36a
d3c36a
* Wed Sep 28 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.6.bzr457
d3c36a
- Consolidated selinux file context patches
d3c36a
- Fixed cloud-init.service dependencies
d3c36a
- Updated sshkeytypes patch
d3c36a
- Dealt with differences from Ubuntu's sshd
d3c36a
d3c36a
* Sat Sep 24 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.5.bzr457
d3c36a
- Rebased against upstream rev 457
d3c36a
- Added missing dependencies
d3c36a
d3c36a
* Fri Sep 23 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.4.bzr450
d3c36a
- Added more macros to the spec file
d3c36a
d3c36a
* Fri Sep 23 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.3.bzr450
d3c36a
- Fixed logfile permission checking
d3c36a
- Fixed SSH key generation
d3c36a
- Fixed a bad method call in FQDN-guessing [LP:857891]
d3c36a
- Updated localefile patch
d3c36a
- Disabled the grub_dpkg module
d3c36a
- Fixed failures due to empty script dirs [LP:857926]
d3c36a
d3c36a
* Fri Sep 23 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.2.bzr450
d3c36a
- Updated tzsysconfig patch
d3c36a
d3c36a
* Wed Sep 21 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.1.bzr450
d3c36a
- Initial packaging