From 3e26e9102c722a25e72cca8989ef0fcbd3c06ec3bc55cba2a9879906e8eeff39 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Fri, 19 Jul 2013 14:51:15 +0000 Subject: [PATCH] Accepting request 183655 from Cloud:Tools Automatic submission by obs-autosubmit OBS-URL: https://build.opensuse.org/request/show/183655 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cloud-init?expand=0&rev=5 --- cloud-init.changes | 45 +++++++++++++++- cloud-init.spec | 107 +++++++++++++++++++++++---------------- cloud.cfg.suse | 1 - fixupSysVinit.patch | 121 +++++++++++++++++++++++++++++++++++++++++--- slesHandler.patch | 2 +- 5 files changed, 220 insertions(+), 56 deletions(-) diff --git a/cloud-init.changes b/cloud-init.changes index 23c08bd..2c4b96f 100644 --- a/cloud-init.changes +++ b/cloud-init.changes @@ -1,5 +1,46 @@ ------------------------------------------------------------------- -Tue Jun 18 21:28:58 UTC 2013 - rschweikert@suse.com +Thu Jul 11 08:00:50 UTC 2013 - speilicke@suse.com + +- Install service files into /lib/systemd/system on 12.2, the UsrMove + happened afterwards + +------------------------------------------------------------------- +Wed Jul 10 07:15:50 UTC 2013 - speilicke@suse.com + +- Re-imported from IBS and some cleanup +- Package LICENSE +- Install service files to /usr/lib/systemd/system, not /etc/... +- Drop %py_requires, there are several autorequires for SLES and openSUSE +- Drop $all facility Required-Start in sysvinit/cloud-final + +------------------------------------------------------------------- +Wed Jun 26 15:41:24 UTC 2013 - bwiedemann@suse.com + +- require python-boto >= 2.7 because it fails with 2.5.2 + +------------------------------------------------------------------- +Wed Jun 26 13:07:41 UTC 2013 - rschweikert@suse.com + +- fix stray character in patch introduced by previous changes + +------------------------------------------------------------------- +Wed Jun 26 12:37:10 UTC 2013 - rschweikert@suse.com + +- fix zypper command in slesHandler, use non-interactive mode + +------------------------------------------------------------------- +Wed Jun 19 17:32:11 UTC 2013 - rschweikert@suse.com + +- fix duplicate entry in the config w.r.t. ssh key generation +- fix distro indicator setting, sles vs. opensuse + +------------------------------------------------------------------- +Tue Jun 18 21:48:21 UTC 2013 - rschweikert@suse.com + +- Integrate the sysV init script changes from Jens + +------------------------------------------------------------------- +Tue Jun 18 21:23:46 UTC 2013 - rschweikert@suse.com - integrate changes from HP + update the sles handler, do not modify the util code integrate @@ -10,7 +51,7 @@ Tue Jun 18 21:28:58 UTC 2013 - rschweikert@suse.com ~ python-argparse ~ python-configobj ~ python-oauth - + update the cloud-init config file + + update the cloud-init config file ------------------------------------------------------------------- Sat Jun 15 10:40:42 UTC 2013 - rschweikert@suse.com diff --git a/cloud-init.spec b/cloud-init.spec index 0abaf7c..474b2bf 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -15,23 +15,24 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # - -%define component cloud-init - -Name: %{component} +Name: cloud-init Version: 0.7.2 Release: 0 -Summary: Cloud node initialization tool License: GPL-3.0 -Group: System/Management +Summary: Cloud node initialization tool Url: http://launchpad.net/cloud-init/ -Source0: %{component}-%{version}.tar.bz2 +Group: System/Management +Source0: %{name}-%{version}.tar.bz2 Source1: cloud.cfg.suse Patch0: fixupSysVinit.patch Patch1: slesHandler.patch Patch2: openSUSEHandler.diff +BuildRequires: fdupes +BuildRequires: filesystem +BuildRequires: python-devel +BuildRequires: python-setuptools Requires: python-argparse -Requires: python-boto +Requires: python-boto >= 2.7 Requires: python-cheetah Requires: python-configobj Requires: python-oauth @@ -39,67 +40,70 @@ Requires: python-prettytable Requires: python-requests Requires: python-xml Requires: python-yaml -BuildRequires: filesystem -BuildRequires: python-devel -BuildRequires: python-setuptools -#BuildRequires: python-distribute -BuildRequires: fdupes BuildRoot: %{_tmppath}/%{name}-%{version}-build %define docdir %{_defaultdocdir}/%{name} - %if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %else BuildArch: noarch %endif - %if 0%{?suse_version} && 0%{?suse_version} <= 1210 %define initsys sysvinit %else %define initsys systemd +BuildRequires: systemd +%{?systemd_requires} +%if 0%{?suse_version} && 0%{?suse_version} == 1220 +%define systemd_prefix /lib +%else +%define systemd_prefix /usr/lib +%endif %endif - -%{py_requires} %description Cloud-init is an init script that initializes a cloud node (VM) according to the fetched configuration data from the admin node. -Authors: --------- - Scott Moser - %package doc -Summary: Cloud node initialization tool doc +Summary: Cloud node initialization tool - Documentation Group: System/Management -Recommends: cloud-init = %version +Recommends: cloud-init = %{version} %description doc +Cloud-init is an init script that initializes a cloud node (VM) +according to the fetched configuration data from the admin node. + Documentation and examples for cloud-init tools %package test -Summary: Cloud node initialization tool tests +Summary: Cloud node initialization tool - Testsuite Group: System/Management -Requires: cloud-init = %version +Requires: cloud-init = %{version} %description test +Cloud-init is an init script that initializes a cloud node (VM) +according to the fetched configuration data from the admin node. + Unit tests for the cloud-init tools %prep -%setup -q -n %{component}-%{version} +%setup -q %patch0 %patch1 -p1 %patch2 -p1 %if 0%{?suse_version} <= 1130 # disable ecdsa for SLE 11 (not available) -echo "ssh_genkeytypes: ['rsa', 'dsa']" >> %{S:1} +echo "ssh_genkeytypes: ['rsa', 'dsa']" >> %{SOURCE1} %endif +# Install service files into correct location +sed -i "s|/etc/systemd/system|%{systemd_prefix}/systemd/system|" setup.py +# Drop $all facility Required-Start in sysvinit/cloud-final: +sed -i "s|\$all cloud-config|cloud-config|" sysvinit/cloud-final %build python setup.py build %install -python setup.py install --skip-build --root=%{buildroot} --prefix=%{_prefix} --record-rpm=INSTALLED_FILES --install-lib=%{python_sitelib} --init-system=%{initsys} +python setup.py install --root=%{buildroot} --prefix=%{_prefix} --install-lib=%{python_sitelib} --init-system=%{initsys} find %{buildroot} \( -name .gitignore -o -name .placeholder \) -delete # from debian install script for x in "%{buildroot}%{_bindir}/"*.py; do @@ -108,16 +112,23 @@ done mkdir -p %{buildroot}%{_localstatedir}/lib/cloud # move documentation mkdir -p %{buildroot}%{_defaultdocdir} -mv %{buildroot}/usr/share/doc/%{component} %{buildroot}%{docdir} -cp -a %{S:1} %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg +mv %{buildroot}%{_datadir}/doc/%{name} %{buildroot}%{docdir} +cp -a %{SOURCE1} %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg +# Set the distribution indicator %if 0%{?suse_version} -%if 0%{?sles_version} != 0 +%if 0%{?suse_version} < 1130 sed -i s/INSERT_SUSE_DISTRO/sles/ %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg %endif -%if 0%{?sles_version} == 0 +%if 0%{?suse_version} > 1140 sed -i s/INSERT_SUSE_DISTRO/opensuse/ %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg %endif %endif +#grep Enterprise /etc/SuSE-release >& /dev/null +#if [ $? = 0 ]; then +#sed -i s/INSERT_SUSE_DISTRO/sles/ %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg +#else +#sed -i s/INSERT_SUSE_DISTRO/opensuse/ %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg +#fi # remove debian/ubuntu specific profile.d file (bnc#779553) rm -f %{buildroot}%{_sysconfdir}/profile.d/Z99-cloud-locale-test.sh @@ -139,21 +150,32 @@ popd %fdupes %{buildroot}%{python_sitelib} %endif +%postun +%insserv_cleanup + %files %defattr(-,root,root) -%{python_sitelib}/cloudinit -%{python_sitelib}/cloud_init*egg-info %{_bindir}/cloud-init %{_bindir}/cloud-init-per %config(noreplace) %{_sysconfdir}/cloud/ -/usr/lib/cloud-init +%{python_sitelib}/cloudinit +%{python_sitelib}/cloud_init-%{version}-py%{py_ver}.egg-info +%{_prefix}/lib/cloud-init %if 0%{?suse_version} && 0%{?suse_version} <= 1210 -%{_sbindir}/rc* -%attr(0755, root, root) %{_initddir}/* +%{_sbindir}/rccloud-config +%{_sbindir}/rccloud-init +%{_sbindir}/rccloud-init-local +%{_sbindir}/rccloud-final +%attr(0755, root, root) %{_initddir}/cloud-config +%attr(0755, root, root) %{_initddir}/cloud-init +%attr(0755, root, root) %{_initddir}/cloud-init-local +%attr(0755, root, root) %{_initddir}/cloud-final %else -%dir /etc/systemd -%dir /etc/systemd/system -%{_sysconfdir}/systemd/system/* +%{systemd_prefix}/systemd/system/cloud-config.service +%{systemd_prefix}/systemd/system/cloud-config.target +%{systemd_prefix}/systemd/system/cloud-init-local.service +%{systemd_prefix}/systemd/system/cloud-init.service +%{systemd_prefix}/systemd/system/cloud-final.service %endif %dir %attr(0755, root, root) %{_localstatedir}/lib/cloud @@ -165,7 +187,4 @@ popd %defattr(-,root,root) %{python_sitelib}/tests -%postun -%insserv_cleanup - %changelog diff --git a/cloud.cfg.suse b/cloud.cfg.suse index 44a7928..b2f9497 100644 --- a/cloud.cfg.suse +++ b/cloud.cfg.suse @@ -7,7 +7,6 @@ disable_root: false preserve_hostname: false syslog_fix_perms: root:root mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2'] -ssh_genkeytypes: ['rsa', 'dsa'] # The modules that run in the 'init' stage cloud_init_modules: diff --git a/fixupSysVinit.patch b/fixupSysVinit.patch index b56776e..91b82c9 100644 --- a/fixupSysVinit.patch +++ b/fixupSysVinit.patch @@ -1,52 +1,157 @@ +Index: sysvinit/cloud-config +=================================================================== --- sysvinit/cloud-config.orig +++ sysvinit/cloud-config -@@ -27,8 +27,8 @@ +@@ -27,9 +27,9 @@ # Provides: cloud-config # Required-Start: cloud-init cloud-init-local # Should-Start: $time -# Required-Stop: -# Should-Stop: +-# Default-Start: 2 3 4 5 +# Required-Stop: $null +# Should-Stop: $null - # Default-Start: 2 3 4 5 ++# Default-Start: 2 3 5 # Default-Stop: 0 1 6 # Short-Description: The config cloud-init job + # Description: Start cloud-init and runs the config phase +@@ -62,6 +62,9 @@ conf="/etc/cloud/cloud.cfg" + [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init + [ -f /etc/default/cloud-init ] && . /etc/default/cloud-init + ++. /etc/rc.status ++rc_reset ++ + start() { + [ -x $cloud_init ] || return 5 + [ -f $conf ] || return 6 +@@ -118,4 +121,6 @@ case "$1" in + ;; + esac + +-exit $RETVAL ++_rc_status=$RETVAL ++rc_status -v ++rc_exit +Index: sysvinit/cloud-final +=================================================================== --- sysvinit/cloud-final.orig +++ sysvinit/cloud-final -@@ -27,8 +27,8 @@ +@@ -27,9 +27,9 @@ # Provides: cloud-final # Required-Start: $all cloud-config # Should-Start: $time -# Required-Stop: -# Should-Stop: +-# Default-Start: 2 3 4 5 +# Required-Stop: $null +# Should-Stop: $null - # Default-Start: 2 3 4 5 ++# Default-Start: 2 3 5 # Default-Stop: 0 1 6 # Short-Description: The final cloud-init job + # Description: Start cloud-init and runs the final phase +@@ -62,6 +62,9 @@ conf="/etc/cloud/cloud.cfg" + [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init + [ -f /etc/default/cloud-init ] && . /etc/default/cloud-init + ++. /etc/rc.status ++rc_reset ++ + start() { + [ -x $cloud_init ] || return 5 + [ -f $conf ] || return 6 +@@ -118,4 +121,6 @@ case "$1" in + ;; + esac + +-exit $RETVAL ++_rc_status=$RETVAL ++rc_status -v ++rc_exit +Index: sysvinit/cloud-init +=================================================================== --- sysvinit/cloud-init.orig +++ sysvinit/cloud-init -@@ -27,8 +27,8 @@ +@@ -27,9 +27,9 @@ # Provides: cloud-init # Required-Start: $local_fs $network $named $remote_fs cloud-init-local # Should-Start: $time -# Required-Stop: -# Should-Stop: +-# Default-Start: 2 3 4 5 +# Required-Stop: $null +# Should-Stop: $null - # Default-Start: 2 3 4 5 ++# Default-Start: 2 3 5 # Default-Stop: 0 1 6 # Short-Description: The initial cloud-init job (net and fs contingent) + # Description: Start cloud-init and runs the initialization phase +@@ -62,6 +62,9 @@ conf="/etc/cloud/cloud.cfg" + [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init + [ -f /etc/default/cloud-init ] && . /etc/default/cloud-init + ++. /etc/rc.status ++rc_reset ++ + start() { + [ -x $cloud_init ] || return 5 + [ -f $conf ] || return 6 +@@ -103,6 +106,8 @@ case "$1" in + ;; + status) + echo -n $"Checking for service $prog:" ++ RETVAL=3 ++ [ -e /root/.ssh/authorized_keys ] && RETVAL=0 + # Return value is slightly different for the status command: + # 0 - service up and running + # 1 - service dead, but /var/run/ pid file exists +@@ -110,7 +115,6 @@ case "$1" in + # 3 - service not running (unused) + # 4 - service status unknown :-( + # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) +- RETVAL=3 + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|condrestart|restart|force-reload|reload}" +@@ -118,4 +122,6 @@ case "$1" in + ;; + esac + +-exit $RETVAL ++_rc_status=$RETVAL ++rc_status -v ++rc_exit +Index: sysvinit/cloud-init-local +=================================================================== --- sysvinit/cloud-init-local.orig +++ sysvinit/cloud-init-local -@@ -27,8 +27,8 @@ +@@ -27,9 +27,9 @@ # Provides: cloud-init-local # Required-Start: $local_fs $remote_fs # Should-Start: $time -# Required-Stop: -# Should-Stop: +-# Default-Start: 2 3 4 5 +# Required-Stop: $null +# Should-Stop: $null - # Default-Start: 2 3 4 5 ++# Default-Start: 2 3 5 # Default-Stop: 0 1 6 # Short-Description: The initial cloud-init job (local fs contingent) + # Description: Start cloud-init and runs the initialization phases +@@ -62,6 +62,9 @@ conf="/etc/cloud/cloud.cfg" + [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init + [ -f /etc/default/cloud-init ] && . /etc/default/cloud-init + ++. /etc/rc.status ++rc_reset ++ + start() { + [ -x $cloud_init ] || return 5 + [ -f $conf ] || return 6 +@@ -118,4 +121,6 @@ case "$1" in + ;; + esac + +-exit $RETVAL ++_rc_status=$RETVAL ++rc_status -v ++rc_exit diff --git a/slesHandler.patch b/slesHandler.patch index 02354be..4aac80a 100644 --- a/slesHandler.patch +++ b/slesHandler.patch @@ -341,7 +341,7 @@ Index: cloud-init-0.7.2/cloudinit/distros/sles.py + + cmd = ['zypper'] + # No user interaction possible, enable non-interactive mode -+ cmd.append('-t') ++ cmd.append('--non-interactive') + # Do not check the keys, we assume that the initial repos configured + # in the image can be trusted + cmd.append('--no-gpg-checks')