Blame cloud-init-0.6.3-no-runparts.patch
|
|
1829b52 |
=== modified file 'cloudinit/util.py'
|
|
|
1829b52 |
--- cloudinit/util.py 2012-02-29 00:12:33 +0000
|
|
|
1829b52 |
+++ cloudinit/util.py 2012-03-05 17:55:03 +0000
|
|
|
1829b52 |
@@ -209,16 +209,17 @@
|
|
|
1829b52 |
if skip_no_exist and not os.path.isdir(dirp):
|
|
|
1829b52 |
return
|
|
|
1829b52 |
|
|
|
1829b52 |
- # per bug 857926, Fedora's run-parts will exit failure on empty dir
|
|
|
1829b52 |
- if os.path.isdir(dirp) and os.listdir(dirp) == []:
|
|
|
1829b52 |
- return
|
|
|
1829b52 |
-
|
|
|
1829b52 |
- cmd = ['run-parts', '--regex', '.*', dirp]
|
|
|
1829b52 |
- sp = subprocess.Popen(cmd)
|
|
|
1829b52 |
- sp.communicate()
|
|
|
1829b52 |
- if sp.returncode is not 0:
|
|
|
1829b52 |
- raise subprocess.CalledProcessError(sp.returncode, cmd)
|
|
|
1829b52 |
- return
|
|
|
1829b52 |
+ failed = 0
|
|
|
1829b52 |
+ for exe_name in sorted(os.listdir(dirp)):
|
|
|
1829b52 |
+ exe_path = os.path.join(dirp, exe_name)
|
|
|
1829b52 |
+ if os.path.isfile(exe_path) and os.access(exe_path, os.X_OK):
|
|
|
1829b52 |
+ popen = subprocess.Popen([exe_path])
|
|
|
1829b52 |
+ popen.communicate()
|
|
|
1829b52 |
+ if popen.returncode is not 0:
|
|
|
1829b52 |
+ failed += 1
|
|
|
1829b52 |
+ print >> sys.stderr, exe_path, 'failed; code', popen.returncode
|
|
|
1829b52 |
+ if failed:
|
|
|
1829b52 |
+ raise RuntimeError('runparts: %i failures' % failed)
|
|
|
1829b52 |
|
|
|
1829b52 |
|
|
|
1829b52 |
def subp(args, input_=None):
|
|
|
1829b52 |
|