summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Williams <neil.williams@linaro.org>2016-08-31 13:18:56 (GMT)
committerNeil Williams <neil.williams@linaro.org>2016-08-31 13:18:56 (GMT)
commit28e3d0cc8fd80610d8fd078a55a20da43c5a2d7e (patch)
treef8808a67f15f466f1538f737c9d496bae2018c49
parent2a6591286cbbc8f738ee12ddce4cd850700667f8 (diff)
downloadlava-dispatcher-28e3d0cc8fd80610d8fd078a55a20da43c5a2d7e.tar.gz
lava-dispatcher-28e3d0cc8fd80610d8fd078a55a20da43c5a2d7e.tar.xz
Handle exceptions from subprocess from compression
compress/decompress does not raise OSError if the subprocess exited non-zero, so ensure this exception is caught so that the cleanup actions are executed. Change-Id: I8d12d6a43352cb5d542653c39e1f5cf3e36c9aa8
-rw-r--r--lava_dispatcher/pipeline/utils/compression.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lava_dispatcher/pipeline/utils/compression.py b/lava_dispatcher/pipeline/utils/compression.py
index 0f42175..e9d9b42 100644
--- a/lava_dispatcher/pipeline/utils/compression.py
+++ b/lava_dispatcher/pipeline/utils/compression.py
@@ -49,7 +49,7 @@ def compress_file(infile, compression):
log = subprocess.check_output(cmd, shell=True)
os.chdir(pwd)
return "%s.%s" % (infile, compression)
- except OSError as exc:
+ except (OSError, subprocess.CalledProcessError) as exc:
raise RuntimeError('unable to compress file %s: %s' % (infile, exc))
@@ -67,7 +67,7 @@ def decompress_file(infile, compression):
# safe to use shell=True here, no external arguments
log = subprocess.check_output(cmd, shell=True)
return outfile
- except OSError as exc:
+ except (OSError, subprocess.CalledProcessError) as exc:
raise RuntimeError('unable to decompress file %s: %s' % (infile, exc))