[cloud-init/f17] Fix runparts() compabitility with Fedora

gholms gholms at fedoraproject.org
Mon Mar 5 22:14:53 UTC 2012


commit 1829b52a1931faafc56777dec4685b3b083148a9
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Mon Mar 5 13:34:38 2012 -0800

    Fix runparts() compabitility with Fedora

 cloud-init-0.6.3-no-runparts.patch |   32 ++++++++++++++++++++++++++++++++
 cloud-init.spec                    |    5 +++++
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/cloud-init-0.6.3-no-runparts.patch b/cloud-init-0.6.3-no-runparts.patch
new file mode 100644
index 0000000..1577cdc
--- /dev/null
+++ b/cloud-init-0.6.3-no-runparts.patch
@@ -0,0 +1,32 @@
+=== 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.spec b/cloud-init.spec
index 4244be8..585db44 100644
--- a/cloud-init.spec
+++ b/cloud-init.spec
@@ -13,6 +13,9 @@ Source0:        %{name}-%{version}-bzr532.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
 
 BuildArch:      noarch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -46,6 +49,7 @@ ssh keys and to let the user run various scripts.
 %prep
 %setup -q -n %{name}-%{version}-bzr532
 %patch0 -p0
+%patch1 -p0
 
 cp -p %{SOURCE2} README.fedora
 
@@ -129,6 +133,7 @@ fi
 %changelog
 * Mon Mar  5 2012 Garrett Holmstrom <gholms at fedoraproject.org> - 0.6.3-0.1.bzr532
 - Rebased against upstream rev 532
+- Fixed runparts() incompatibility with Fedora
 
 * Thu Jan 12 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.6.2-0.8.bzr457
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild


More information about the scm-commits mailing list