diff --git a/cloud-init-0.6.3-fedora.patch b/cloud-init-0.6.3-fedora.patch deleted file mode 100644 index 64fe4f7..0000000 --- a/cloud-init-0.6.3-fedora.patch +++ /dev/null @@ -1,28 +0,0 @@ -=== modified file 'cloudinit/CloudConfig/cc_keys_to_console.py' ---- cloudinit/CloudConfig/cc_keys_to_console.py 2012-01-18 14:07:33 +0000 -+++ cloudinit/CloudConfig/cc_keys_to_console.py 2012-03-05 21:53:13 +0000 -@@ -26,7 +26,7 @@ - - - def handle(_name, cfg, _cloud, log, _args): -- cmd = ['/usr/lib/cloud-init/write-ssh-key-fingerprints'] -+ cmd = ['/usr/libexec/cloud-init/write-ssh-key-fingerprints'] - fp_blacklist = util.get_cfg_option_list_or_str(cfg, - "ssh_fp_console_blacklist", []) - key_blacklist = util.get_cfg_option_list_or_str(cfg, - -=== modified file 'setup.py' ---- setup.py 2011-12-20 16:39:46 +0000 -+++ setup.py 2012-03-05 22:00:19 +0000 -@@ -40,9 +40,8 @@ - data_files=[('/etc/cloud', glob('config/*.cfg')), - ('/etc/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')), - ('/etc/cloud/templates', glob('templates/*')), -- ('/etc/init', glob('upstart/*.conf')), - ('/usr/share/cloud-init', []), -- ('/usr/lib/cloud-init', -+ ('/usr/libexec/cloud-init', - ['tools/uncloud-init', 'tools/write-ssh-key-fingerprints']), - ('/usr/share/doc/cloud-init', filter(is_f,glob('doc/*'))), - ('/usr/share/doc/cloud-init/examples', filter(is_f,glob('doc/examples/*'))), - diff --git a/cloud-init-0.6.3-fqdn.patch b/cloud-init-0.6.3-fqdn.patch deleted file mode 100644 index 879882e..0000000 --- a/cloud-init-0.6.3-fqdn.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- cloud-init-0.6.3-bzr532/cloudinit/DataSourceEc2.py.fqdn 2012-03-05 11:05:34.000000000 -0800 -+++ cloud-init-0.6.3-bzr532/cloudinit/DataSourceEc2.py 2012-09-13 13:40:29.757623464 -0700 -@@ -110,7 +110,7 @@ class DataSourceEc2(DataSource.DataSourc - util.logexc(log) - log.warn("Failed to get timeout, using %s" % timeout) - -- def_mdurls = ["http://169.254.169.254", "http://instance-data:8773"] -+ def_mdurls = ["http://169.254.169.254", "http://instance-data.:8773"] - mdurls = mcfg.get("metadata_urls", def_mdurls) - - # Remove addresses from the list that wont resolve. diff --git a/cloud-init-0.6.3-lp970071.patch b/cloud-init-0.6.3-lp970071.patch deleted file mode 100644 index 0fe9376..0000000 --- a/cloud-init-0.6.3-lp970071.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- cloud-init-0.6.3-bzr532.orig/cloudinit/SshUtil.py 2012-03-05 14:05:34.000000000 -0500 -+++ cloud-init-0.6.3-bzr532/cloudinit/SshUtil.py 2012-03-31 15:21:30.365271359 -0400 -@@ -155,6 +155,8 @@ - akeys = ssh_cfg.get("AuthorizedKeysFile", "%h/.ssh/authorized_keys") - akeys = akeys.replace("%h", pwent.pw_dir) - akeys = akeys.replace("%u", user) -+ if not akeys.startswith('/'): -+ akeys = os.path.join(pwent.pw_dir, akeys) - authorized_keys = akeys - except Exception: - authorized_keys = '%s/.ssh/authorized_keys' % pwent.pw_dir diff --git a/cloud-init-0.6.3-no-runparts.patch b/cloud-init-0.6.3-no-runparts.patch deleted file mode 100644 index 1577cdc..0000000 --- a/cloud-init-0.6.3-no-runparts.patch +++ /dev/null @@ -1,32 +0,0 @@ -=== modified file 'cloudinit/util.py' ---- cloudinit/util.py 2012-02-29 00:12:33 +0000 -+++ cloudinit/util.py 2012-03-05 17:55:03 +0000 -@@ -209,16 +209,17 @@ - if skip_no_exist and not os.path.isdir(dirp): - return - -- # per bug 857926, Fedora's run-parts will exit failure on empty dir -- if os.path.isdir(dirp) and os.listdir(dirp) == []: -- return -- -- cmd = ['run-parts', '--regex', '.*', dirp] -- sp = subprocess.Popen(cmd) -- sp.communicate() -- if sp.returncode is not 0: -- raise subprocess.CalledProcessError(sp.returncode, cmd) -- return -+ failed = 0 -+ for exe_name in sorted(os.listdir(dirp)): -+ exe_path = os.path.join(dirp, exe_name) -+ if os.path.isfile(exe_path) and os.access(exe_path, os.X_OK): -+ popen = subprocess.Popen([exe_path]) -+ popen.communicate() -+ if popen.returncode is not 0: -+ failed += 1 -+ print >> sys.stderr, exe_path, 'failed; code', popen.returncode -+ if failed: -+ raise RuntimeError('runparts: %i failures' % failed) - - - def subp(args, input_=None): - diff --git a/cloud-init-0.6.3-systemd-stdout.patch b/cloud-init-0.6.3-systemd-stdout.patch deleted file mode 100644 index 04b59b3..0000000 --- a/cloud-init-0.6.3-systemd-stdout.patch +++ /dev/null @@ -1,52 +0,0 @@ -Index: cloud-init-0.6.3-bzr532/systemd/cloud-config.service -=================================================================== ---- cloud-init-0.6.3-bzr532.orig/systemd/cloud-config.service -+++ cloud-init-0.6.3-bzr532/systemd/cloud-config.service -@@ -10,5 +10,8 @@ ExecStart=/usr/bin/cloud-init-cfg all co - RemainAfterExit=yes - TimeoutSec=0 - -+# Output needs to appear in instance console output -+StandardOutput=tty -+ - [Install] - WantedBy=multi-user.target -Index: cloud-init-0.6.3-bzr532/systemd/cloud-final.service -=================================================================== ---- cloud-init-0.6.3-bzr532.orig/systemd/cloud-final.service -+++ cloud-init-0.6.3-bzr532/systemd/cloud-final.service -@@ -10,5 +10,8 @@ ExecStart=/usr/bin/cloud-init-cfg all fi - RemainAfterExit=yes - TimeoutSec=0 - -+# Output needs to appear in instance console output -+StandardOutput=tty -+ - [Install] - WantedBy=multi-user.target -Index: cloud-init-0.6.3-bzr532/systemd/cloud-init-local.service -=================================================================== ---- cloud-init-0.6.3-bzr532.orig/systemd/cloud-init-local.service -+++ cloud-init-0.6.3-bzr532/systemd/cloud-init-local.service -@@ -9,5 +9,8 @@ ExecStart=/usr/bin/cloud-init start-loca - RemainAfterExit=yes - TimeoutSec=0 - -+# Output needs to appear in instance console output -+StandardOutput=tty -+ - [Install] - WantedBy=multi-user.target -Index: cloud-init-0.6.3-bzr532/systemd/cloud-init.service -=================================================================== ---- cloud-init-0.6.3-bzr532.orig/systemd/cloud-init.service -+++ cloud-init-0.6.3-bzr532/systemd/cloud-init.service -@@ -10,5 +10,8 @@ ExecStart=/usr/bin/cloud-init start - RemainAfterExit=yes - TimeoutSec=0 - -+# Output needs to appear in instance console output -+StandardOutput=tty -+ - [Install] - WantedBy=multi-user.target diff --git a/cloud-init-0.6.3-systemd-timeout.patch b/cloud-init-0.6.3-systemd-timeout.patch deleted file mode 100644 index 723e748..0000000 --- a/cloud-init-0.6.3-systemd-timeout.patch +++ /dev/null @@ -1,48 +0,0 @@ -Index: cloud-init-0.6.3-bzr532/systemd/cloud-config.service -=================================================================== ---- cloud-init-0.6.3-bzr532.orig/systemd/cloud-config.service -+++ cloud-init-0.6.3-bzr532/systemd/cloud-config.service -@@ -8,6 +8,7 @@ Wants=network.target - Type=oneshot - ExecStart=/usr/bin/cloud-init-cfg all config - RemainAfterExit=yes -+TimeoutSec=0 - - [Install] - WantedBy=multi-user.target -Index: cloud-init-0.6.3-bzr532/systemd/cloud-final.service -=================================================================== ---- cloud-init-0.6.3-bzr532.orig/systemd/cloud-final.service -+++ cloud-init-0.6.3-bzr532/systemd/cloud-final.service -@@ -8,6 +8,7 @@ Wants=network.target - Type=oneshot - ExecStart=/usr/bin/cloud-init-cfg all final - RemainAfterExit=yes -+TimeoutSec=0 - - [Install] - WantedBy=multi-user.target -Index: cloud-init-0.6.3-bzr532/systemd/cloud-init-local.service -=================================================================== ---- cloud-init-0.6.3-bzr532.orig/systemd/cloud-init-local.service -+++ cloud-init-0.6.3-bzr532/systemd/cloud-init-local.service -@@ -7,6 +7,7 @@ After=local-fs.target - Type=oneshot - ExecStart=/usr/bin/cloud-init start-local - RemainAfterExit=yes -+TimeoutSec=0 - - [Install] - WantedBy=multi-user.target -Index: cloud-init-0.6.3-bzr532/systemd/cloud-init.service -=================================================================== ---- cloud-init-0.6.3-bzr532.orig/systemd/cloud-init.service -+++ cloud-init-0.6.3-bzr532/systemd/cloud-init.service -@@ -8,6 +8,7 @@ Wants=local-fs.target cloud-init-local.s - Type=oneshot - ExecStart=/usr/bin/cloud-init start - RemainAfterExit=yes -+TimeoutSec=0 - - [Install] - WantedBy=multi-user.target diff --git a/cloud-init-0.6.3-yum.patch b/cloud-init-0.6.3-yum.patch deleted file mode 100644 index 39af26a..0000000 --- a/cloud-init-0.6.3-yum.patch +++ /dev/null @@ -1,79 +0,0 @@ -From b36b33335c4872bc1bef5bcece33c3ea43de4ea5 Mon Sep 17 00:00:00 2001 -From: Tomas Karasek -Date: Wed, 27 Jun 2012 16:48:15 +0100 -Subject: [PATCH] support package installation using 'yum' - ---- - cloudinit/CloudConfig/__init__.py | 42 +++++++++++++++++++++++++++++++++--- - 1 files changed, 38 insertions(+), 4 deletions(-) - -diff --git a/cloudinit/CloudConfig/__init__.py b/cloudinit/CloudConfig/__init__.py -index a16bdde..6a7005a 100644 ---- a/cloudinit/CloudConfig/__init__.py -+++ b/cloudinit/CloudConfig/__init__.py -@@ -27,6 +27,7 @@ import traceback - import os - import subprocess - import time -+import platform - - per_instance = cloudinit.per_instance - per_always = cloudinit.per_always -@@ -253,6 +254,27 @@ def run_per_instance(name, func, args, clear_on_fail=False): - raise - - -+def get_package_manager(): -+ if 'linux_distribution' in platform.__dict__: -+ distname, _, _ = platform.linux_distribution( -+ full_distribution_name=0) -+ else: -+ distname, _, _ = platform.dist() -+ yum_dists = ['redhat', 'fedora', 'centos'] -+ apt_dists = ['debian', 'ubuntu'] -+ if distname.lower() in yum_dists: -+ return 'yum' -+ elif distname.lower() in apt_dists: -+ return 'apt' -+ elif os.system('yum --help >/dev/null 2>&1'): -+ return 'yum' -+ elif os.system('apt-get --help >/dev/null 2>&1'): -+ return 'apt' -+ -+ -+_PACKAGE_MANAGER = get_package_manager() -+ -+ - # apt_get top level command (install, update...), and args to pass it - def apt_get(tlc, args=None): - if args is None: -@@ -265,10 +287,22 @@ def apt_get(tlc, args=None): - subprocess.check_call(cmd, env=e) - - --def update_package_sources(): -- run_per_instance("update-sources", apt_get, ("update",)) -+def yum(tlc, args=None): -+ if args is None: -+ args = [] -+ cmd = ['yum', '-y', tlc] -+ cmd.extend(args) -+ subprocess.check_call(cmd) - - - def install_packages(pkglist): -- update_package_sources() -- apt_get("install", pkglist) -+ if _PACKAGE_MANAGER == "yum": -+ run_per_instance("update-sources", yum, ("makecache",)) -+ yum("install", pkglist) -+ elif _PACKAGE_MANAGER == "apt": -+ run_per_instance("update-sources", apt_get, ("update",)) -+ apt_get("install", pkglist) -+ else: -+ raise Exception("Unknown distribution, unable to install packages %s" % -+ pkglist) -+ --- -1.7.6.4 - diff --git a/cloud-init-0.7.0-fedora.patch b/cloud-init-0.7.0-fedora.patch new file mode 100644 index 0000000..af42b65 --- /dev/null +++ b/cloud-init-0.7.0-fedora.patch @@ -0,0 +1,35 @@ +Index: cloud-init/cloudinit/config/cc_keys_to_console.py +=================================================================== +--- cloud-init.orig/cloudinit/config/cc_keys_to_console.py ++++ cloud-init/cloudinit/config/cc_keys_to_console.py +@@ -26,7 +26,7 @@ from cloudinit import util + frequency = PER_INSTANCE + + # This is a tool that cloud init provides +-HELPER_TOOL = '/usr/lib/cloud-init/write-ssh-key-fingerprints' ++HELPER_TOOL = '/usr/libexec/cloud-init/write-ssh-key-fingerprints' + + + def handle(name, cfg, _cloud, log, _args): +Index: cloud-init/setup.py +=================================================================== +--- cloud-init.orig/setup.py ++++ cloud-init/setup.py +@@ -43,7 +43,7 @@ INITSYS_FILES = { + } + INITSYS_ROOTS = { + 'sysvinit': '/etc/rc.d/init.d', +- 'systemd': '/etc/systemd/system/', ++ 'systemd': '/usr/lib/systemd/system/', + 'upstart': '/etc/init/', + } + INITSYS_TYPES = sorted(list(INITSYS_ROOTS.keys())) +@@ -120,7 +120,7 @@ setuptools.setup(name='cloud-init', + ('/etc/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')), + ('/etc/cloud/templates', glob('templates/*')), + ('/usr/share/cloud-init', []), +- ('/usr/lib/cloud-init', ++ ('/usr/libexec/cloud-init', + ['tools/uncloud-init', + 'tools/write-ssh-key-fingerprints']), + ('/usr/share/doc/cloud-init', diff --git a/cloud-init-0.7.0-useradd-selinux.patch b/cloud-init-0.7.0-useradd-selinux.patch new file mode 100644 index 0000000..78d2cde --- /dev/null +++ b/cloud-init-0.7.0-useradd-selinux.patch @@ -0,0 +1,34 @@ +Index: trunk/cloudinit/distros/__init__.py +=================================================================== +--- trunk.orig/cloudinit/distros/__init__.py ++++ trunk/cloudinit/distros/__init__.py +@@ -239,6 +239,7 @@ class Distro(object): + "shell": '--shell', + "expiredate": '--expiredate', + "inactive": '--inactive', ++ "selinux-user": '--selinux-user', + } + + adduser_opts_flags = { +Index: trunk/doc/examples/cloud-config-user-groups.txt +=================================================================== +--- trunk.orig/doc/examples/cloud-config-user-groups.txt ++++ trunk/doc/examples/cloud-config-user-groups.txt +@@ -12,6 +12,7 @@ users: + gecos: Foo B. Bar + primary-group: foobar + groups: users ++ selinux-user: staff_u + expiredate: 2012-09-01 + ssh-import-id: foobar + lock-passwd: false +@@ -38,6 +39,9 @@ users: + # primary-group: define the primary group. Defaults to a new group created + # named after the user. + # groups: Optional. Additional groups to add the user to. Defaults to none ++# selinux-user: Optional. The SELinux user for the user's login, such as ++# "staff_u". When this is omitted the system will select the default ++# SELinux user. + # lock-passwd: Defaults to true. Lock the password to disable password login + # inactive: Create the user as inactive + # passwd: The hash -- not the password itself -- of the password you want diff --git a/cloud-init-0.7.0-yum-clean.patch b/cloud-init-0.7.0-yum-clean.patch new file mode 100644 index 0000000..0335b7c --- /dev/null +++ b/cloud-init-0.7.0-yum-clean.patch @@ -0,0 +1,13 @@ +Index: cloud-init/cloudinit/distros/rhel.py +=================================================================== +--- cloud-init.orig/cloudinit/distros/rhel.py ++++ cloud-init/cloudinit/distros/rhel.py +@@ -208,7 +208,7 @@ class Distro(distros.Distro): + + def update_package_sources(self): + self._runner.run("update-sources", self.package_command, +- ["update"], freq=PER_INSTANCE) ++ ["clean", "expire-cache"], freq=PER_INSTANCE) + + + # This class helps adjust the configobj diff --git a/cloud-init.spec b/cloud-init.spec index 6dce916..da8e5d3 100644 --- a/cloud-init.spec +++ b/cloud-init.spec @@ -1,35 +1,24 @@ %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} Name: cloud-init -Version: 0.6.3 -Release: 0.5.bzr532%{?dist} +Version: 0.7.0 +Release: 0.1.bzr650%{?dist} Summary: Cloud instance init scripts Group: System Environment/Base License: GPLv3 URL: http://launchpad.net/cloud-init -# bzr export -r 532 cloud-init-0.6.3-bzr532.tar.gz lp:cloud-init -Source0: %{name}-%{version}-bzr532.tar.gz +# bzr export -r 650 cloud-init-0.7.0-bzr650.tar.gz lp:cloud-init +Source0: %{name}-%{version}-bzr650.tar.gz Source1: cloud-init-fedora.cfg Source2: cloud-init-README.fedora -Patch0: cloud-init-0.6.3-fedora.patch -# Make runparts() work on Fedora -# https://bugs.launchpad.net/cloud-init/+bug/934404 -Patch1: cloud-init-0.6.3-no-runparts.patch -# https://bugs.launchpad.net/cloud-init/+bug/970071 -Patch2: cloud-init-0.6.3-lp970071.patch -# Add support for installing packages with yum -Patch3: cloud-init-0.6.3-yum.patch -# https://bugzilla.redhat.com/show_bug.cgi?id=850916 -# https://bugs.launchpad.net/cloud-init/+bug/1040200 -# http://bazaar.launchpad.net/~cloud-init-dev/cloud-init/trunk/revision/635 -Patch4: cloud-init-0.6.3-fqdn.patch -# Kill off timeouts for when users' cloud-config jobs take > 90s to finish -# https://bugzilla.redhat.com/show_bug.cgi?id=836269 -Patch5: cloud-init-0.6.3-systemd-timeout.patch -# Send output to console so euca-get-console-output works -# https://bugzilla.redhat.com/show_bug.cgi?id=854654 -Patch6: cloud-init-0.6.3-systemd-stdout.patch +Patch0: cloud-init-0.7.0-fedora.patch +# Make update_package_sources stop upgrading packages +# https://code.launchpad.net/~gholms/cloud-init/yum-clean/+merge/125001 +Patch1: cloud-init-0.7.0-yum-clean.patch +# Add support for useradd --selinux-user +# https://code.launchpad.net/~gholms/cloud-init/useradd-selinux/+merge/124998 +Patch2: cloud-init-0.7.0-useradd-selinux.patch BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -41,10 +30,12 @@ Requires: e2fsprogs Requires: iproute Requires: libselinux-python Requires: net-tools +Requires: policycoreutils-python Requires: procps Requires: python-boto Requires: python-cheetah Requires: python-configobj +Requires: python-prettytable Requires: PyYAML Requires: rsyslog Requires: shadow-utils @@ -61,14 +52,10 @@ ssh keys and to let the user run various scripts. %prep -%setup -q -n %{name}-%{version}-bzr532 -%patch0 -p0 -%patch1 -p0 +%setup -q -n %{name}-%{version}-bzr650 +%patch0 -p1 +%patch1 -p1 %patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 cp -p %{SOURCE2} README.fedora @@ -81,15 +68,11 @@ cp -p %{SOURCE2} README.fedora rm -rf $RPM_BUILD_ROOT %{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT -for x in $RPM_BUILD_ROOT/%{_bindir}/*.py; do mv "$x" "${x%.py}"; done -chmod +x $RPM_BUILD_ROOT/%{python_sitelib}/cloudinit/SshUtil.py mkdir -p $RPM_BUILD_ROOT/%{_sharedstatedir}/cloud # We supply our own config file since our software differs from Ubuntu's. cp -p %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg -# Note that /etc/rsyslog.d didn't exist by default until F15. -# el6 request: https://bugzilla.redhat.com/show_bug.cgi?id=740420 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d cp -p tools/21-cloudinit.conf $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf @@ -150,6 +133,10 @@ fi %changelog +* Mon Sep 17 2012 Garrett Holmstrom - 0.7.0-0.1.bzr650 +- Rebased against upstream rev 650 +- Added support for useradd --selinux-user + * Thu Sep 13 2012 Garrett Holmstrom - 0.6.3-0.5.bzr532 - Use a FQDN (instance-data.) for instance data URL fallback [RH:850916 LP:1040200] - Shut off systemd timeouts [RH:836269]