diff options
author | Michal Srb <michal@redhat.com> | 2017-08-21 18:11:04 +0200 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2017-10-10 10:36:50 +0100 |
commit | d33c63a230092e94f966551968c51e8c5760742f (patch) | |
tree | 7352f3bee6525609664ad32ad75436af1af0c54e | |
parent | 6fc42802b87f95dba1d6bfda49ae158143e7799c (diff) | |
download | sos-d33c63a230092e94f966551968c51e8c5760742f.tar.gz |
[jars] Catch zipfile.BadZipfile exception
Bad ZIP files can raise zipfile.BadZipfile exception.
Fixes:
Traceback (most recent call last):
File "/home/msrb/projects/sos/sos/sosreport.py", line 1252, in setup
plug.setup()
File "/home/msrb/projects/sos/sos/plugins/jars.py", line 72, in setup
if Jars.is_jar(path):
File "/home/msrb/projects/sos/sos/plugins/jars.py", line 98, in is_jar
with zipfile.ZipFile(path) as f:
File "/usr/lib64/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib64/python2.7/zipfile.py", line 842, in _RealGetContents
raise BadZipfile("Bad magic number for central directory")
BadZipfile: Bad magic number for central directory
Signed-off-by: Michal Srb <michal@redhat.com>
-rw-r--r-- | sos/plugins/jars.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sos/plugins/jars.py b/sos/plugins/jars.py index 486ac05f..8c6b54f4 100644 --- a/sos/plugins/jars.py +++ b/sos/plugins/jars.py @@ -98,7 +98,7 @@ class Jars(Plugin, RedHatPlugin): with zipfile.ZipFile(path) as f: if "META-INF/MANIFEST.MF" in f.namelist(): return True - except IOError: + except (IOError, zipfile.BadZipfile): pass return False |