diff options
author | David Bradford <david.bradford@mongodb.com> | 2018-06-12 13:28:09 -0400 |
---|---|---|
committer | David Bradford <david.bradford@mongodb.com> | 2018-06-12 13:57:33 -0400 |
commit | 91144d00e4ee8fb776405c41ecdd5f6b8f376523 (patch) | |
tree | 986126ac4c490daadbb861099ef0a03c7d7a12a8 | |
parent | 91659755f80511bc811cf2639747acb82544e0ab (diff) | |
download | mongo-91144d00e4ee8fb776405c41ecdd5f6b8f376523.tar.gz |
SERVER-34371: log errors from rmtree
(cherry picked from commit 85d4c70b894b3f2ebc19115a573bf01b27ac89e1)
-rw-r--r-- | buildscripts/resmokelib/testing/fixtures/standalone.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/buildscripts/resmokelib/testing/fixtures/standalone.py b/buildscripts/resmokelib/testing/fixtures/standalone.py index 7aaa34fa3de..9e7c7ff6e3a 100644 --- a/buildscripts/resmokelib/testing/fixtures/standalone.py +++ b/buildscripts/resmokelib/testing/fixtures/standalone.py @@ -48,8 +48,14 @@ class MongoDFixture(interface.Fixture): def setup(self): """Set up the mongod.""" - if not self.preserve_dbpath: - utils.rmtree(self._dbpath, ignore_errors=True) + if not self.preserve_dbpath and os.path.lexists(self._dbpath): + + def handle_rmtree_failure(fn, path, excinfo): + """Handle a failure from rmtree.""" + self.logger.warning("'%s' threw an exception trying to act on '%s'." + " excinfo: %s.", fn, path, excinfo[:2]) + + utils.rmtree(self._dbpath, ignore_errors=False, onerror=handle_rmtree_failure) try: os.makedirs(self._dbpath) |