Mercurial > hg > autobot
comparison autobot/template/restart_buildbot.py @ 301:aec0a7f8c191
STUB: autobot/template/restart_buildbot.py
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 11 May 2014 09:48:20 -0700 |
parents | 2cda5a640ae7 |
children |
comparison
equal
deleted
inserted
replaced
300:aeaf4494c7d8 | 301:aec0a7f8c191 |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 """(re)start the buildbot""" | 3 """(re)start the buildbot""" |
4 | 4 |
5 import optparse | 5 import argparse |
6 import os | 6 import os |
7 import sys | 7 import sys |
8 from subprocess import call | 8 from subprocess import call |
9 from time import sleep | |
10 | 9 |
11 here = os.path.abspath(os.path.dirname(sys.argv[0])) | 10 here = os.path.abspath(os.path.dirname(sys.argv[0])) |
12 debug = {{debug}} | 11 debug = {{debug}} |
13 | 12 |
13 | |
14 def main(args=sys.argv[1:]): | 14 def main(args=sys.argv[1:]): |
15 """CLI""" | |
15 | 16 |
16 # parse command line options | 17 # parse command line options |
17 usage = '%prog [options]' | 18 parser = argparse.ArgumentParser(description=__doc__) |
18 parser = optparse.OptionParser(usage=usage, description=__doc__) | 19 parser.add_argument('--stop', dest='stop', |
19 parser.add_option('--stop', dest='stop', | |
20 action='store_true', default=False, | 20 action='store_true', default=False, |
21 help="stop the buildbot only") | 21 help="stop the buildbot only; don't restart") |
22 # could force a build here | 22 # TODO: could force a build here: |
23 # buildbot sendchange ... | 23 # buildbot sendchange ... |
24 options, args = parser.parse_args(args) | 24 options = parser.parse_args(args) |
25 | 25 |
26 # cleanup | 26 # cleanup |
27 if debug: | 27 if debug: |
28 call(['rm', '-f', 'master/twistd.log'], cwd=here) | 28 call(['rm', '-f', 'master/twistd.log'], cwd=here) |
29 call(['rm', '-f', 'slave/twistd.log'], cwd=here) | 29 call(['rm', '-f', 'slave/twistd.log'], cwd=here) |