Commit bd06df0
sshdriver: Cleanup after process exits
Cleanup of the temporary directory should not occur until after SSH has
exited, as SSH will delete the control socket which can race with the
shutil.rmtree() and result in strange errors like:
tools/labgrid/venv/lib/python3.10/site-packages/labgrid/environment.py:65: in cleanup
self.targets[target].cleanup()
tools/labgrid/venv/lib/python3.10/site-packages/labgrid/target.py:555: in cleanup
self.deactivate_all_drivers()
tools/labgrid/venv/lib/python3.10/site-packages/labgrid/target.py:505: in deactivate_all_drivers
self.deactivate(drv)
tools/labgrid/venv/lib/python3.10/site-packages/labgrid/target.py:498: in deactivate
client.on_deactivate()
tools/labgrid/venv/lib/python3.10/site-packages/labgrid/driver/sshdriver.py:65: in on_deactivate
self._cleanup_own_master()
tools/labgrid/venv/lib/python3.10/site-packages/labgrid/driver/sshdriver.py:483: in _cleanup_own_master
shutil.rmtree(self.tmpdir)
/usr/lib/python3.10/shutil.py:724: in rmtree
_rmtree_safe_fd(fd, path, onerror)
/usr/lib/python3.10/shutil.py:680: in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
...
FileNotFoundError: [Errno 2] No such file or directory: 'control-172.16.6.0%enx5c857e32b0e4'
Also ignore errors while running shutil.rmtree() since it a best effort
cleanup
Signed-off-by: Joshua Watt <Joshua.Watt@garmin.com>
(cherry picked from commit 937217b)1 parent 5111f34 commit bd06df0
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
480 | 480 | | |
481 | 481 | | |
482 | 482 | | |
483 | | - | |
484 | 483 | | |
485 | 484 | | |
486 | 485 | | |
| 486 | + | |
| 487 | + | |
487 | 488 | | |
488 | 489 | | |
489 | 490 | | |
| |||
0 commit comments