aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2012-12-06 15:43:39 +0000
committerBryn M. Reeves <bmr@redhat.com>2012-12-06 15:43:39 +0000
commit94983b9685b7a9bc17d5fa97ceed823e621f9644 (patch)
tree499c40b21f392ad69257abc0558214227a737adc
parent3cce6b26999bab1fa2770445aa06d994387b1d55 (diff)
downloadsos-94983b9685b7a9bc17d5fa97ceed823e621f9644.tar.gz
Remove redundant exception handling in postgresql module
If we pass a 'None' into shutil.rmtree() it will os.path.join() that with a string leading to a TypeError: Traceback (most recent call last): File "/usr/sbin/sosreport", line 23, in <module> main(sys.argv[1:]) File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 961, in main sos.execute() TypeError: coercing to Unicode: need string or buffer, NoneType found > /usr/lib64/python2.7/posixpath.py(133)islink() -> st = os.lstat(path) Rather than catch the exception test tmp_dir before calling rmtree.
-rw-r--r--sos/plugins/postgresql.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py
index 62fdcbec..6a999f45 100644
--- a/sos/plugins/postgresql.py
+++ b/sos/plugins/postgresql.py
@@ -57,9 +57,5 @@ class postgresql(Plugin, RedHatPlugin):
def postproc(self):
import shutil
- if self.tmp_dir == None:
- return
- try:
+ if self.tmp_dir:
shutil.rmtree(self.tmp_dir)
- except:
- pass