SPECS/cloud-init/cloud-init.spec
5a6db02a
 %define python3_sitelib /usr/lib/python3.7/site-packages
30b63cfb
 
f4d17450
 Name:           cloud-init
828b155e
 Version:        18.3
2737be27
 Release:        2%{?dist}
f4d17450
 Summary:        Cloud instance init scripts
 Group:          System Environment/Base
 License:        GPLv3
 URL:            http://launchpad.net/cloud-init
5a6db02a
 Vendor:         VMware, Inc
 Distribution:   Photon
f4d17450
 Source0:        https://launchpad.net/cloud-init/trunk/%{version}/+download/%{name}-%{version}.tar.gz
828b155e
 %define sha1 cloud-init=a317e2add93578d244328dcf97d46fad1c3140f9
f4d17450
 Source1:        cloud-photon.cfg
223641bd
 Source2:        99-disable-networking-config.cfg
f4d17450
 
 Patch0:         photon-distro.patch
e650449f
 Patch2:         vca-admin-pwd.patch
40184939
 Patch3:         photon-hosts-template.patch
 Patch5:         datasource-guestinfo.patch
 Patch6:         systemd-service-changes.patch
1991c5c6
 Patch7:         makecheck.patch
37f01a69
 Patch8:         systemd-resolved-config.patch
ff320b57
 Patch9:         cloud-init-azureds.patch
2737be27
 Patch10:        ds-identity.patch
f4d17450
 
30b63cfb
 BuildRequires:  python3
 BuildRequires:  python3-libs
ebcd0400
 BuildRequires:  systemd
40184939
 BuildRequires:  dbus
30b63cfb
 BuildRequires:  python3-ipaddr
40184939
 BuildRequires:  iproute2
 BuildRequires:  automake
a848bcf8
 BuildRequires:  python3-setuptools
 BuildRequires:  python3-xml
828b155e
 BuildRequires:  python3-six
 # %if %{with_check}
 BuildRequires:  python3-requests
 # %endif
 BuildRequires:  python3-PyYAML
 BuildRequires:  python3-urllib3
 BuildRequires:  python3-chardet
 BuildRequires:  python3-certifi
 BuildRequires:  python3-idna
 BuildRequires:  python3-jinja2
40184939
 
ebcd0400
 Requires:       systemd
7f9d2e12
 Requires:       (net-tools or toybox)
30b63cfb
 Requires:       python3
 Requires:       python3-libs
 Requires:       python3-configobj
 Requires:       python3-prettytable
 Requires:       python3-requests
 Requires:       python3-PyYAML
 Requires:       python3-jsonpatch
 Requires:       python3-oauthlib
 Requires:       python3-jinja2
 Requires:       python3-markupsafe
 Requires:       python3-six
374b1064
 Requires:       python3-setuptools
 Requires:       python3-xml
828b155e
 Requires:       python3-jsonschema
421d1f6b
 BuildArch:      noarch
f4d17450
 
 %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
 %setup -q -n %{name}-%{version}
 %patch0 -p1
e650449f
 %patch2 -p1
668f1091
 %patch3 -p1
558038ba
 %patch5 -p1
a08ad732
 %patch6 -p1
1991c5c6
 %patch7 -p1
37f01a69
 %patch8 -p1
ff320b57
 %patch9 -p1
2737be27
 %patch10 -p1
e650449f
 
828b155e
 find systemd -name "cloud*.service*" | xargs sed -i s/StandardOutput=journal+console/StandardOutput=journal/g
f4d17450
 
 %build
30b63cfb
 python3 setup.py build
f4d17450
 
 %install
 rm -rf $RPM_BUILD_ROOT
30b63cfb
 python3 setup.py install -O1 --skip-build --root=%{buildroot} --init-system systemd
f4d17450
 
30b63cfb
 mkdir -p %{buildroot}/var/lib/cloud
223641bd
 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg.d/
f4d17450
 
 # We supply our own config file since our software differs from Ubuntu's.
30b63cfb
 cp -p %{SOURCE1} %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg
 
223641bd
 # Disable networking config by cloud-init
 cp -p %{SOURCE2} $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg.d/
f4d17450
 
23a6af57
 %check
1991c5c6
 easy_install_3=$(ls /usr/bin |grep easy_install |grep 3)
 ln -s /usr/bin/pip3 /usr/bin/pip
 $easy_install_3 tox
 tox -e py36
23a6af57
 
f4d17450
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post
f66608a4
 %systemd_post cloud-config.service
 %systemd_post cloud-final.service
 %systemd_post cloud-init.service
 %systemd_post cloud-init-local.service
f4d17450
 
 %preun
f66608a4
 %systemd_preun cloud-config.service
 %systemd_preun cloud-final.service
 %systemd_preun cloud-init.service
 %systemd_preun cloud-init-local.service
f4d17450
 
 %postun
10b4c4f7
 %systemd_postun cloud-config.service
 %systemd_postun cloud-final.service
 %systemd_postun cloud-init.service
 %systemd_postun cloud-init-local.service
f4d17450
 
 %files
 %license LICENSE
40184939
 %doc %{_sysconfdir}/cloud/cloud.cfg.d/README
 %dir %{_sysconfdir}/cloud/templates
 %config(noreplace) %{_sysconfdir}/cloud/templates/*
 %config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/05_logging.cfg
 %config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
223641bd
 %config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/99-disable-networking-config.cfg
40184939
 %{_sysconfdir}/NetworkManager/dispatcher.d/hook-network-manager
 %{_sysconfdir}/dhcp/dhclient-exit-hooks.d/hook-dhclient
 /lib/systemd/system-generators/cloud-init-generator
 /lib/udev/rules.d/66-azure-ephemeral.rules
f269ffe9
 /lib/systemd/system/*
828b155e
 /etc/bash_completion.d/cloud-init
f4d17450
 %{_docdir}/cloud-init/*
 %{_libdir}/cloud-init/*
30b63cfb
 %{python3_sitelib}/*
f4d17450
 %{_bindir}/cloud-init*
 %dir /var/lib/cloud
 
 
 %changelog
2737be27
 *   Tue Dec 04 2018 Ajay Kaher <akaher@vmware.com> 18.3-2
 -   Fix auto startup at boot time
828b155e
 *   Wed Oct 24 2018 Ajay Kaher <akaher@vmware.com> 18.3-1
 -   Upgraded version to 18.3
5a6db02a
 *   Sun Oct 07 2018 Tapas Kundu <tkundu@vmware.com> 0.7.9-15
 -   Updated using python 3.7 lib
ff320b57
 *   Wed Feb 28 2018 Anish Swaminathan <anishs@vmware.com> 0.7.9-14
 -   Add support for systemd constructs for azure DS
37f01a69
 *   Mon Oct 16 2017 Vinay Kulkarni <kulakrniv@vmware.com> 0.7.9-13
 -   Support configuration of systemd resolved.conf
7f9d2e12
 *   Wed Sep 20 2017 Alexey Makhalov <amakhalov@vmware.com> 0.7.9-12
 -   Requires net-tools or toybox
 *   Wed Sep 20 2017 Anish Swaminathan <anishs@vmware.com> 0.7.9-11
28fe8447
 -   Fix the interface id returned from vmxguestinfo
1991c5c6
 *   Tue Aug 22 2017 Chang Lee <changlee@vmware.com> 0.7.9-10
 -   Fixed %check
7b40bb76
 *   Wed Jul 19 2017 Divya Thaluru <dthaluru@vmware.com> 0.7.9-9
 -   Enabled openstack provider
7be9dd9e
 *   Wed Jun 28 2017 Anish Swaminathan <anishs@vmware.com> 0.7.9-8
 -   Restart network service in bring_up_interfaces
374b1064
 *   Thu Jun 22 2017 Xiaolin Li <xiaolinl@vmware.com> 0.7.9-7
 -   Add python3-setuptools and python3-xml to requires.
a848bcf8
 *   Wed Jun 07 2017 Xiaolin Li <xiaolinl@vmware.com> 0.7.9-6
 -   Add python3-setuptools and python3-xml to python3 sub package Buildrequires.
4afe1da8
 *   Mon Jun 5 2017 Julian Vassev <jvassev@vmware.com> 0.7.9-5
 -   Enable OVF datasource by default
30b63cfb
 *   Mon May 22 2017 Kumar Kaushik <kaushikk@vmware.com> 0.7.9-4
 -   Making cloud-init to use python3.
5a6db02a
 *   Mon May 15 2017 Anish Swaminathan <anishs@vmware.com> 0.7.9-3
223641bd
 -   Disable networking config by cloud-init
f0dd0d50
 *   Thu May 04 2017 Anish Swaminathan <anishs@vmware.com> 0.7.9-2
 -   Support userdata in vmx guestinfo
40184939
 *   Thu Apr 27 2017 Anish Swaminathan <anishs@vmware.com> 0.7.9-1
 -   Upgraded to version 0.7.9
 -   Enabled VmxGuestinfo datasource
421d1f6b
 *   Thu Apr 27 2017 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 0.7.6-17
 -   Fix Arch
a08ad732
 *   Wed Mar 29 2017 Kumar Kaushik <kaushikk@vmware.com>  0.7.6-16
 -   Adding support for disk partition and resize fs
558038ba
 *   Thu Dec 15 2016 Dheeraj Shetty <dheerajs@vmware.com>  0.7.6-15
 -   Adding template file and python-jinja2 dependency to update hosts
50986668
 *   Tue Dec 13 2016 Dheeraj Shetty <dheerajs@vmware.com>  0.7.6-14
 -   Fixed restarting of sshd daemon
d25ea91b
 *   Tue Nov 22 2016 Kumar Kaushik <kaushikk@vmware.com>  0.7.6-13
 -   Adding flag for vmware customization in config.
10b4c4f7
 *   Tue Nov 1 2016 Divya Thaluru <dthaluru@vmware.com>  0.7.6-12
 -   Fixed logic to not restart services after upgrade
fc21a164
 *   Mon Oct 24 2016 Divya Thaluru <dthaluru@vmware.com>  0.7.6-11
 -   Enabled ssh module in cloud-init
ba416d95
 *   Thu May 26 2016 Divya Thaluru <dthaluru@vmware.com>  0.7.6-10
5a6db02a
 -   Fixed logic to restart the active services after upgrade
d25ea91b
 *   Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 0.7.6-9
 -   GA - Bump release of all rpms
f66608a4
 *   Tue May 3 2016 Divya Thaluru <dthaluru@vmware.com>  0.7.6-8
 -   Clean up post, preun, postun sections in spec file.
ebcd0400
 *   Thu Dec 10 2015 Xiaolin Li <xiaolinl@vmware.com>
 -   Add systemd to Requires and BuildRequires.
d25ea91b
 *   Thu Sep 17 2015 Kumar Kaushik <kaushikk@vmware.com>
 -   Removing netstat and replacing with ip route.
 *   Tue Aug 11 2015 Kumar Kaushik <kaushikk@vmware.com>
 -   VCA initial password issue fix.
 *   Thu Jun 25 2015 Kumar Kaushik <kaushikk@vmware.com>
 -   Removing systemd-service.patch. No longer needed.
 *   Thu Jun 18 2015 Vinay Kulkarni <kulkarniv@vmware.com>
 -   Add patch to enable logging to /var/log/cloud-init.log
 *   Mon May 18 2015 Touseef Liaqat <tliaqat@vmware.com>
 -   Update according to UsrMove.
 *   Wed Mar 04 2015 Mahmoud Bassiouny <mbassiouny@vmware.com>
 -   Initial packaging for Photon