From 83245c4ac800c248754da77efbb7e3d3f8cf3b308aa0bf5fb97308831c742b50 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Fri, 26 Apr 2013 05:12:13 +0000 Subject: [PATCH] Accepting request 172828 from Base:System initial package OBS-URL: https://build.opensuse.org/request/show/172828 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/cloud-init?expand=0&rev=1 --- .gitattributes | 23 ++++++ .gitignore | 1 + cloud-init-0.6.3.tar.bz2 | 3 + cloud-init.changes | 42 +++++++++++ cloud-init.init | 74 +++++++++++++++++++ cloud-init.spec | 116 ++++++++++++++++++++++++++++++ cloud.cfg.suse | 39 ++++++++++ drop-MAAS-datasource.diff | 13 ++++ drop-python27-only-code.diff | 22 ++++++ drop-ubuntu-default-username.diff | 39 ++++++++++ 10 files changed, 372 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 cloud-init-0.6.3.tar.bz2 create mode 100644 cloud-init.changes create mode 100644 cloud-init.init create mode 100644 cloud-init.spec create mode 100644 cloud.cfg.suse create mode 100644 drop-MAAS-datasource.diff create mode 100644 drop-python27-only-code.diff create mode 100644 drop-ubuntu-default-username.diff diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/cloud-init-0.6.3.tar.bz2 b/cloud-init-0.6.3.tar.bz2 new file mode 100644 index 0000000..e9080ce --- /dev/null +++ b/cloud-init-0.6.3.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:643b54792d0a4e6578678c6ac4cceab600a030539dc0d73575442713fc3e834c +size 102993 diff --git a/cloud-init.changes b/cloud-init.changes new file mode 100644 index 0000000..f7bd962 --- /dev/null +++ b/cloud-init.changes @@ -0,0 +1,42 @@ +------------------------------------------------------------------- +Wed Sep 19 12:42:07 UTC 2012 - jdsn@suse.de + +- fix usage of patches for openSUSE builds + +------------------------------------------------------------------- +Thu Sep 13 16:44:26 UTC 2012 - jdsn@suse.de + +- drop ubuntu as default user name +- disable ssh ecdsa host key creation on SLE11 + +------------------------------------------------------------------- +Wed Sep 12 16:28:01 UTC 2012 - jdsn@suse.de + +- replace python 2.7 code with 2.5 compliant code + +------------------------------------------------------------------- +Tue Sep 11 13:32:34 UTC 2012 - jdsn@suse.de + +- drop debian specific checks (bnc#779553) + +------------------------------------------------------------------- +Mon Sep 10 14:32:27 UTC 2012 - jdsn@suse.com + +- Add python-xml Requires that was missing (bnc#779588). + +------------------------------------------------------------------- +Fri Jul 20 13:04:01 UTC 2012 - jdsn@suse.com + +- fix init script, use killproc for stop operation (bnc#771803) + +------------------------------------------------------------------- +Tue Jul 3 15:51:01 UTC 2012 - cthiel@suse.com + +- change license to SPDX format + +------------------------------------------------------------------- +Wed Jun 27 09:34:01 UTC 2012 - jdsn@suse.de + +- rename to cloud-init +- drop MAAS support to avoid oauth dependency + diff --git a/cloud-init.init b/cloud-init.init new file mode 100644 index 0000000..aab8473 --- /dev/null +++ b/cloud-init.init @@ -0,0 +1,74 @@ +#!/bin/sh +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Author: J. Daniel Schmidt +# +# This library is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; version 2.1 of the License +# +# /etc/init.d/cloud-init +# and its symbolic link +# /usr/sbin/rccloud-init +# +# +### BEGIN INIT INFO +# Provides: cloud-init +# Required-Start: $network $syslog $remote_fs $named +# Should-Start: $time +# Required-Stop: $null +# Should-Stop: $null +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Starts the cloud-init process +# Description: Starts the cloud-init process that fetches +# the configuration for the system from a cloud controller. +### END INIT INFO + + +# Check for missing binaries (stale symlinks should not happen) +# Note: Special treatment of stop for LSB conformance +CLOUDINIT_BIN=/usr/bin/cloud-init +test -x $CLOUDINIT_BIN || { echo "$CLOUDINIT_BIN not installed"; + if [ "$1" = "stop" ]; then exit 0; + else exit 5; fi; } + +# Check for existence of needed config file and read it +#CLOUDINIT_CONFIG=/etc/cloud/cloud.cfg +#test -r $CLOUDINIT_CONFIG || { echo "$CLOUDINIT_CONFIG not existing"; +# if [ "$1" = "stop" ]; then exit 0; +# else exit 6; fi; } + + +. /etc/rc.status +rc_reset + +case "$1" in + start) + echo -n "Starting cloud-init " + startproc $CLOUDINIT_BIN start + rc_status -v + ;; + + stop) + echo -n "Shutting down cloud-init " + killproc $CLOUDINIT_BIN + rc_status -v + ;; + + restart) + $0 stop + $0 start + rc_status + ;; + + status) + echo -n "Checking for service cloud-init" + [ -e /root/.ssh/authorized_keys ] + rc_status -v + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac +rc_exit diff --git a/cloud-init.spec b/cloud-init.spec new file mode 100644 index 0000000..af296c0 --- /dev/null +++ b/cloud-init.spec @@ -0,0 +1,116 @@ +# +# spec file for package cloud-init +# +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +%define component cloud-init + +Name: %{component} +Version: 0.6.3 +Release: 0 +License: GPL-3.0 +Summary: Cloud node initialization tool +Url: http://launchpad.net/cloud-init/ +Group: System/Management +Source0: %{component}-%{version}.tar.bz2 +Source1: cloud.cfg.suse +Source2: cloud-init.init +Patch0: drop-MAAS-datasource.diff +Patch1: drop-python27-only-code.diff +Patch2: drop-ubuntu-default-username.diff +Requires: python-yaml python-cheetah python-boto python-xml +BuildRequires: python-devel +BuildRequires: python-setuptools +BuildRequires: filesystem +#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 + +%{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 + +%prep +%setup -q -n %{component}-%{version} +%patch0 -p1 +%if 0%{?suse_version} <= 1130 +%patch1 -p1 +# disable ecdsa for SLE 11 (not available) +echo "ssh_genkeytypes: ['rsa', 'dsa']" >> %{S:1} +%endif +%patch2 -p1 + +%build +python setup.py build + +%install +python setup.py install --skip-build --root=%{buildroot} --prefix=%{_prefix} --record-rpm=INSTALLED_FILES --install-lib=%{python_sitelib} +find %{buildroot} \( -name .gitignore -o -name .placeholder \) -delete +mv %{buildroot}/%{_sysconfdir}/init %{buildroot}/%{_sysconfdir}/cloud/ +# from debian install script +for x in "%{buildroot}%{_bindir}/"*.py; do + [ -f "${x}" ] && mv "${x}" "${x%.py}" +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 +mkdir -p %{buildroot}/%{_initddir} %{buildroot}/%{_sbindir} +cp -a %SOURCE2 %{buildroot}/%{_initddir}/%{component} +ln -s %{_initddir}/%{component} %{buildroot}/%{_sbindir}/rc%{component} + +# remove debian/ubuntu specific profile.d file (bnc#779553) +rm -f %{buildroot}%{_sysconfdir}/profile.d/Z99-cloud-locale-test.sh + +# remove duplicate files +%if 0%{?suse_version} +%fdupes %{buildroot}%{python_sitelib} +%endif + +%files +%defattr(-,root,root) +%{python_sitelib}/cloudinit +%{python_sitelib}/cloud_init*egg-info +%{_bindir}/cloud-init +%{_bindir}/cloud-init-per +%{_bindir}/cloud-init-cfg +%{_sbindir}/rc%{component} +%config(noreplace) %{_sysconfdir}/cloud/ +%doc %{docdir} +/usr/lib/cloud-init +%attr(0755, root, root) %{_initddir}/%{component} +%dir %attr(0755, root, root) %{_localstatedir}/lib/cloud + +%postun +%insserv_cleanup + +%changelog diff --git a/cloud.cfg.suse b/cloud.cfg.suse new file mode 100644 index 0000000..a38973e --- /dev/null +++ b/cloud.cfg.suse @@ -0,0 +1,39 @@ +# adapted default config for (open)SUSE systems +user: root +disable_root: False +preserve_hostname: False +cc_ready_cmd: [ /bin/true ] +syslog_fix_perms: root:root +# datasource_list: ["NoCloud", "ConfigDrive", "OVF", "MAAS", "Ec2", "CloudStack"] + +cloud_init_modules: + - bootcmd + - set_hostname + - update_hostname + - update_etc_hosts + - ca-certs + - rsyslog + - ssh + +cloud_config_modules: + - mounts + - ssh-import-id + - locale + - set-passwords + - landscape + - timezone + - puppet + - chef + - salt-minion + - mcollective + - disable-ec2-metadata + - runcmd + +cloud_final_modules: + - rightscale_userdata + - scripts-per-once + - scripts-per-boot + - scripts-per-instance + - scripts-user + - keys-to-console + - final-message diff --git a/drop-MAAS-datasource.diff b/drop-MAAS-datasource.diff new file mode 100644 index 0000000..630a79a --- /dev/null +++ b/drop-MAAS-datasource.diff @@ -0,0 +1,13 @@ +Index: cloud-init-0.6.3/cloudinit/__init__.py +=================================================================== +--- cloud-init-0.6.3.orig/cloudinit/__init__.py ++++ cloud-init-0.6.3/cloudinit/__init__.py +@@ -29,7 +29,7 @@ cfg_env_name = "CLOUD_CFG" + + cfg_builtin = """ + log_cfgs: [] +-datasource_list: ["NoCloud", "ConfigDrive", "OVF", "MAAS", "Ec2", "CloudStack"] ++datasource_list: ["NoCloud", "ConfigDrive", "OVF", "Ec2", "CloudStack"] + def_log_file: /var/log/cloud-init.log + syslog_fix_perms: syslog:adm + """ diff --git a/drop-python27-only-code.diff b/drop-python27-only-code.diff new file mode 100644 index 0000000..8e8c7d2 --- /dev/null +++ b/drop-python27-only-code.diff @@ -0,0 +1,22 @@ +Index: cloud-init-0.6.3/cloudinit/netinfo.py +=================================================================== +--- cloud-init-0.6.3.orig/cloudinit/netinfo.py ++++ cloud-init-0.6.3/cloudinit/netinfo.py +@@ -24,7 +24,7 @@ import subprocess + + def netdev_info(empty=""): + fields = ("hwaddr", "addr", "bcast", "mask") +- ifcfg_out = str(subprocess.check_output(["ifconfig", "-a"])) ++ ifcfg_out = str(subprocess.Popen(["ifconfig", "-a"], stdout=subprocess.PIPE).communicate()[0]) + devs = {} + for line in ifcfg_out.splitlines(): + if len(line) == 0: +@@ -70,7 +70,7 @@ def netdev_info(empty=""): + + + def route_info(): +- route_out = str(subprocess.check_output(["route", "-n"])) ++ route_out = str(subprocess.Popen(["route", "-n"], stdout=subprocess.PIPE).communicate()[0]) + routes = [] + for line in route_out.splitlines()[1:]: + if not line: diff --git a/drop-ubuntu-default-username.diff b/drop-ubuntu-default-username.diff new file mode 100644 index 0000000..97f0ad0 --- /dev/null +++ b/drop-ubuntu-default-username.diff @@ -0,0 +1,39 @@ +Index: cloud-init-0.6.3/cloudinit/CloudConfig/cc_byobu.py +=================================================================== +--- cloud-init-0.6.3.orig/cloudinit/CloudConfig/cc_byobu.py ++++ cloud-init-0.6.3/cloudinit/CloudConfig/cc_byobu.py +@@ -55,7 +55,7 @@ def handle(_name, cfg, _cloud, log, args + + shcmd = "" + if mod_user: +- user = util.get_cfg_option_str(cfg, "user", "ubuntu") ++ user = util.get_cfg_option_str(cfg, "user", "root") + shcmd += " sudo -Hu \"%s\" byobu-launcher-%s" % (user, bl_inst) + shcmd += " || X=$(($X+1)); " + if mod_sys: +Index: cloud-init-0.6.3/cloudinit/CloudConfig/cc_set_passwords.py +=================================================================== +--- cloud-init-0.6.3.orig/cloudinit/CloudConfig/cc_set_passwords.py ++++ cloud-init-0.6.3/cloudinit/CloudConfig/cc_set_passwords.py +@@ -44,7 +44,7 @@ def handle(_name, cfg, _cloud, log, args + expire = util.get_cfg_option_bool(chfg, 'expire', expire) + + if not plist and password: +- user = util.get_cfg_option_str(cfg, "user", "ubuntu") ++ user = util.get_cfg_option_str(cfg, "user", "root") + plist = "%s:%s" % (user, password) + + errors = [] +Index: cloud-init-0.6.3/cloudinit/CloudConfig/cc_ssh_import_id.py +=================================================================== +--- cloud-init-0.6.3.orig/cloudinit/CloudConfig/cc_ssh_import_id.py ++++ cloud-init-0.6.3/cloudinit/CloudConfig/cc_ssh_import_id.py +@@ -30,7 +30,7 @@ def handle(_name, cfg, _cloud, log, args + if len(args) > 1: + ids = args[1:] + else: +- user = util.get_cfg_option_str(cfg, "user", "ubuntu") ++ user = util.get_cfg_option_str(cfg, "user", "root") + ids = util.get_cfg_option_list_or_str(cfg, "ssh_import_id", []) + + if len(ids) == 0: