aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kolla/image/tasks.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/kolla/image/tasks.py b/kolla/image/tasks.py
index 1242ecd8d..a36ba5cea 100644
--- a/kolla/image/tasks.py
+++ b/kolla/image/tasks.py
@@ -308,9 +308,14 @@ class BuildTask(EngineTask):
archives.append(archive_path)
if archives:
for archive in archives:
- _test_malicious_tarball(archive, items_path)
- with tarfile.open(archive, 'r') as archive_tar:
- archive_tar.extractall(path=items_path) # nosec
+ if tarfile.is_tarfile(archive):
+ _test_malicious_tarball(archive, items_path)
+ with tarfile.open(archive, 'r') as archive_tar:
+ archive_tar.extractall(path=items_path) # nosec
+ else:
+ self.logger.error("Archive %s is not a tarfile",
+ archive)
+ raise ArchivingError
else:
try:
os.mkdir(items_path)