Merge lp:~ben-hutchings/ensoft-sextant/cleanup-fix into lp:ensoft-sextant

Proposed by Ben Hutchings
Status: Superseded
Proposed branch: lp:~ben-hutchings/ensoft-sextant/cleanup-fix
Merge into: lp:ensoft-sextant
Prerequisite: lp:~ben-hutchings/ensoft-sextant/wierd-names-clean
Diff against target: 61 lines (+11/-4)
3 files modified
src/sextant/db_api.py (+9/-2)
src/sextant/sshmanager.py (+2/-1)
src/sextant/web/server.py (+0/-1)
To merge this branch: bzr merge lp:~ben-hutchings/ensoft-sextant/cleanup-fix
Reviewer Review Type Date Requested Status
Robert Pending
Review via email: mp+244604@code.launchpad.net

This proposal has been superseded by a proposal from 2014-12-18.

Commit message

Fixed temporary file issue whereby one instance of sextant could delete the temporary files still being used by another instance (run by the same user).

Description of the change

Fixed temporary file issue whereby one instance of sextant could delete the temporary files still being used by another instance (run by the same user).

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/sextant/db_api.py'
--- src/sextant/db_api.py 2014-12-12 15:02:30 +0000
+++ src/sextant/db_api.py 2014-12-12 15:02:30 +0000
@@ -144,7 +144,7 @@
144 self._ssh = connection._ssh144 self._ssh = connection._ssh
145 self._db = connection._db145 self._db = connection._db
146 146
147 self._tmp_dir = '{}-{}'.format(TMP_DIR, getpass.getuser())147 self._tmp_dir = '{}-{}{}'.format(TMP_DIR, getpass.getuser(), time())
148148
149 # Make the local tmp file - csv files will be written into here.149 # Make the local tmp file - csv files will be written into here.
150 try:150 try:
@@ -293,7 +293,14 @@
293 self.call_writer.file_iter()))293 self.call_writer.file_iter()))
294294
295 for path in file_paths: 295 for path in file_paths:
296 os.remove(path)296 try:
297 os.remove(path)
298 except OSError as e:
299 # If the file doesn't exist just keep going.
300 if e.errno == os.errno.ENOENT:
301 pass
302 else:
303 raise
297304
298 try_rmdir(self._tmp_dir)305 try_rmdir(self._tmp_dir)
299 try_rmdir(TMP_DIR)306 try_rmdir(TMP_DIR)
300307
=== modified file 'src/sextant/sshmanager.py'
--- src/sextant/sshmanager.py 2014-10-17 15:30:14 +0000
+++ src/sextant/sshmanager.py 2014-12-12 15:02:30 +0000
@@ -2,6 +2,7 @@
2import getpass2import getpass
3import logging3import logging
4import subprocess4import subprocess
5import time
56
6"""Provide a class to manage an SSH tunnel and controller"""7"""Provide a class to manage an SSH tunnel and controller"""
7__all__ = ('SSHConnectionError', 'SSHCommandError', 'SSHManager')8__all__ = ('SSHConnectionError', 'SSHCommandError', 'SSHManager')
@@ -82,7 +83,7 @@
82 self.remote_port = remote_port83 self.remote_port = remote_port
83 self.ssh_user = ssh_user84 self.ssh_user = ssh_user
8485
85 self._tmp_dir = '{}-{}'.format(TMP_DIR, self.ssh_user or getpass.getuser())86 self._tmp_dir = '{}-{}{}'.format(TMP_DIR, self.ssh_user or getpass.getuser(), time.time())
8687
87 self._controller_name = 'sextantcontroller{}'.format(local_port)88 self._controller_name = 'sextantcontroller{}'.format(local_port)
88 self._is_localhost = is_localhost89 self._is_localhost = is_localhost
8990
=== modified file 'src/sextant/web/server.py'
--- src/sextant/web/server.py 2014-12-02 14:00:57 +0000
+++ src/sextant/web/server.py 2014-12-12 15:02:30 +0000
@@ -209,7 +209,6 @@
209 res_code = RESPONSE_CODE_BAD_REQUEST209 res_code = RESPONSE_CODE_BAD_REQUEST
210 res_msg = "{}".format(e)210 res_msg = "{}".format(e)
211 print('\tfailed {}'.format(datetime.now()))211 print('\tfailed {}'.format(datetime.now()))
212 raise
213 212
214 213
215 if res_code is RESPONSE_CODE_OK:214 if res_code is RESPONSE_CODE_OK:

Subscribers

People subscribed via source and target branches