summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-10-27 15:57:44 -0400
committerScott Moser <smoser@ubuntu.com>2011-10-27 15:57:44 -0400
commit6fc476625714c56809eacd0df7634dc24b0a4ba3 (patch)
tree6e2092ee2662ba3e511c3cccbc2c7fadcb351231 /cloudinit/util.py
parent869f6d564510c68e8299a2134c92028eb49c5d90 (diff)
downloadvyos-cloud-init-6fc476625714c56809eacd0df7634dc24b0a4ba3.tar.gz
vyos-cloud-init-6fc476625714c56809eacd0df7634dc24b0a4ba3.zip
do not run run-parts if directory has no items
Per bug 857926, on some systems, run-parts will exit failure if the directory is empty. On debian/ubuntu, at least of recent vintage, it exits success. Its reasonable to just not run it. LP: #857926
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 8f50147d..68ce674e 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -134,6 +134,9 @@ def getkeybyid(keyid,keyserver):
def runparts(dirp, skip_no_exist=True):
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()