use the same filename to store traceback and content (#12925)

This commit is contained in:
Serghei Mihai 2016-08-24 16:39:07 +02:00
parent 19e04b00b4
commit ba26fd7726
1 changed files with 3 additions and 2 deletions

View File

@ -133,7 +133,8 @@ if __name__ == '__main__':
mail_dumps_dir = '/var/tmp'
if not os.path.exists(mail_dumps_dir):
os.mkdir(mail_dumps_dir)
filename = os.path.join(mail_dumps_dir, '%s.mail' % uuid.uuid4())
file_id = uuid.uuid4()
filename = os.path.join(mail_dumps_dir, '%s.mail' % file_id)
with open(filename, 'w') as mail_dump:
mail_dump.write(mail)
try:
@ -141,6 +142,6 @@ if __name__ == '__main__':
except Exception as e:
exim = subprocess.Popen(['/usr/sbin/exim', FALLBACK_EMAIL], stdin=file(filename))
trace = traceback.format_exc()
filename = os.path.join(mail_dumps_dir, '%s.trace' % uuid.uuid4())
filename = os.path.join(mail_dumps_dir, '%s.trace' % file_id)
with open(filename, 'w') as mail_dump:
mail_dump.write(trace)