diff options
author | astokes <astokes@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2010-04-23 21:01:40 +0000 |
---|---|---|
committer | astokes <astokes@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2010-04-23 21:01:40 +0000 |
commit | 9f12f3301f5fb30dd12b9462f0890616905c125a (patch) | |
tree | 5cf3043f6bb35153146d9fbaca6886621364d919 | |
parent | b1c5f066381c72415df29ed36f8255c07b671eaf (diff) | |
download | sos-9f12f3301f5fb30dd12b9462f0890616905c125a.tar.gz |
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
-rwxr-xr-x | sos/policyredhat.py | 2 | ||||
-rwxr-xr-x | 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): |