diff options
author | Richard Kreuter <richard@10gen.com> | 2010-07-23 15:52:35 -0400 |
---|---|---|
committer | Richard Kreuter <richard@10gen.com> | 2010-07-23 15:52:52 -0400 |
commit | 5eb10576074a6aeb00982a07a65f1c770b3e14d9 (patch) | |
tree | edca0486e1e3d6b69c8c2404e58312b613f99133 /buildscripts | |
parent | 30d823b6289a70250e171816d4aec6fa86d46be3 (diff) | |
download | mongo-5eb10576074a6aeb00982a07a65f1c770b3e14d9.tar.gz |
Add a --nokill to cleanbb, use it in smoke.py
Diffstat (limited to 'buildscripts')
-rw-r--r-- | buildscripts/cleanbb.py | 24 | ||||
-rwxr-xr-x | buildscripts/smoke.py | 7 |
2 files changed, 22 insertions, 9 deletions
diff --git a/buildscripts/cleanbb.py b/buildscripts/cleanbb.py index e32f34b82da..261519a4977 100644 --- a/buildscripts/cleanbb.py +++ b/buildscripts/cleanbb.py @@ -3,6 +3,7 @@ import sys import os import utils import time +from optparse import OptionParser cwd = os.getcwd(); if cwd.find("buildscripts" ) > 0 : @@ -45,12 +46,14 @@ def killprocs( signal="" ): return killed -def cleanup( root ): +def cleanup( root , nokill ): - - if killprocs() > 0: - time.sleep(3) - killprocs("-9") + if nokill: + print "nokill requested, not killing anybody" + else: + if killprocs() > 0: + time.sleep(3) + killprocs("-9") # delete all regular files, directories can stay # NOTE: if we delete directories later, we can't delete diskfulltest @@ -62,7 +65,12 @@ def cleanup( root ): if __name__ == "__main__": + parser = OptionParser(usage="read the script") + parser.add_option("--nokill", dest='nokill', default=False, action='store_true') + (options, args) = parser.parse_args() + root = "/data/db/" - if len( sys.argv ) > 1: - root = sys.argv[1] - cleanup( root ) + if len(args) > 0: + root = args[0] + + cleanup( root , options.nokill ) diff --git a/buildscripts/smoke.py b/buildscripts/smoke.py index 066d02cb02e..5364e50974b 100755 --- a/buildscripts/smoke.py +++ b/buildscripts/smoke.py @@ -137,7 +137,12 @@ class mongod(object): self.port += 1 self.slave = True if os.path.exists ( dirName ): - call( ["python", "buildscripts/cleanbb.py", dirName] ) + if 'slave' in self.kwargs: + argv = ["python", "buildscripts/cleanbb.py", '--nokill', dirName] + + else: + argv = ["python", "buildscripts/cleanbb.py", dirName] + call( argv ) utils.ensureDir( dirName ) argv = [mongodExecutable, "--port", str(self.port), "--dbpath", dirName] if self.kwargs.get('smallOplog'): |