From 9f12f3301f5fb30dd12b9462f0890616905c125a Mon Sep 17 00:00:00 2001 From: astokes Date: Fri, 23 Apr 2010 21:01:40 +0000 Subject: clean exit on failure to create temporary directory git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@941 ef72aa8b-4018-0410-8976-d6e080ef94d8 --- sos/policyredhat.py | 2 +- sos/sosreport.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sos/policyredhat.py b/sos/policyredhat.py index 345e0616..6cda8556 100755 --- a/sos/policyredhat.py +++ b/sos/policyredhat.py @@ -191,7 +191,7 @@ class SosPolicy: and reports. """ uniqname = "%s-%s" % (self.hostName(), time.strftime("%Y%m%d%H%M%s")) - dstroot = os.path.join(dir,uniqname) + dstroot = os.path.join(tmpdir,uniqname) try: os.mkdir(dstroot, 0700) except: diff --git a/sos/sosreport.py b/sos/sosreport.py index 3e0599fc..9a841de5 100755 --- a/sos/sosreport.py +++ b/sos/sosreport.py @@ -76,7 +76,13 @@ def doExitCode(): def doExit(error=0): """ Exit with return """ - GlobalVars.policy.cleanDstroot() + # We will attempt to clean dstroot; there is only + # one instance where the policy is not set and that is + # during the actual creation of dstroot + try: + GlobalVars.policy.cleanDstroot() + except AttributeError: + sys.exit(error) sys.exit(error) def doException(etype, eval, etrace): -- cgit