summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2020-06-08 14:58:55 -0400
committerGitHub <noreply@github.com>2020-06-08 12:58:55 -0600
commitb36b61debe1556f6dfd2d7ff61fa7bd6b3335fa0 (patch)
tree98f7f27730593895bf8fcba5e859fa2845d79c51 /cloudinit/util.py
parent3c551f6ebc12f7729a2755c89b19b9000e27cc88 (diff)
downloadvyos-cloud-init-b36b61debe1556f6dfd2d7ff61fa7bd6b3335fa0.tar.gz
vyos-cloud-init-b36b61debe1556f6dfd2d7ff61fa7bd6b3335fa0.zip
Move runparts to subp. (#420)
runparts (run a directory of scripts) seems to fit well in subp module. The request to move it there was raised in #416. Replace use of logexc with LOG.debug as logexc comes from util.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py31
1 files changed, 0 insertions, 31 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 445e3d4c..ab2df59e 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -749,37 +749,6 @@ def del_dir(path):
shutil.rmtree(path)
-def runparts(dirp, skip_no_exist=True, exe_prefix=None):
- if skip_no_exist and not os.path.isdir(dirp):
- return
-
- failed = []
- attempted = []
-
- if exe_prefix is None:
- prefix = []
- elif isinstance(exe_prefix, str):
- prefix = [str(exe_prefix)]
- elif isinstance(exe_prefix, list):
- prefix = exe_prefix
- else:
- raise TypeError("exe_prefix must be None, str, or list")
-
- 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):
- attempted.append(exe_path)
- try:
- subp.subp(prefix + [exe_path], capture=False)
- except subp.ProcessExecutionError as e:
- logexc(LOG, "Failed running %s [%s]", exe_path, e.exit_code)
- failed.append(e)
-
- if failed and attempted:
- raise RuntimeError('Runparts: %s failures in %s attempted commands'
- % (len(failed), len(attempted)))
-
-
# read_optional_seed
# returns boolean indicating success or failure (presense of files)
# if files are present, populates 'fill' dictionary with 'user-data' and