| OLD | NEW |
| 1 # Copyright 2014 The LUCI Authors. All rights reserved. | 1 # Copyright 2014 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """Runs either task_runner.py, bot_main.py or bot_config.py. | 5 """Runs either task_runner.py, bot_main.py or bot_config.py. |
| 6 | 6 |
| 7 The imports are done late so if an ImportError occurs, it is localized to this | 7 The imports are done late so if an ImportError occurs, it is localized to this |
| 8 command only. | 8 command only. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 os_utilities.restart() | 83 os_utilities.restart() |
| 84 # Should never reach here. | 84 # Should never reach here. |
| 85 return 1 | 85 return 1 |
| 86 | 86 |
| 87 | 87 |
| 88 def CMDrun_isolated(args): | 88 def CMDrun_isolated(args): |
| 89 """Internal command to run an isolated command.""" | 89 """Internal command to run an isolated command.""" |
| 90 sys.path.insert(0, os.path.join(THIS_FILE, 'client')) | 90 sys.path.insert(0, os.path.join(THIS_FILE, 'client')) |
| 91 # run_isolated setups logging by itself. | 91 # run_isolated setups logging by itself. |
| 92 import run_isolated | 92 import run_isolated |
| 93 return run_isolated.main(args) | 93 return run_isolated.main(run_isolated.get_args(args)) |
| 94 | 94 |
| 95 | 95 |
| 96 def CMDsetup(_args): | 96 def CMDsetup(_args): |
| 97 """Setup the bot to auto-start but doesn't start the bot.""" | 97 """Setup the bot to auto-start but doesn't start the bot.""" |
| 98 logging_utils.prepare_logging(os.path.join('logs', 'bot_config.log')) | 98 logging_utils.prepare_logging(os.path.join('logs', 'bot_config.log')) |
| 99 from bot_code import bot_main | 99 from bot_code import bot_main |
| 100 bot_main.setup_bot(True) | 100 bot_main.setup_bot(True) |
| 101 return 0 | 101 return 0 |
| 102 | 102 |
| 103 | 103 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 with zipfile.ZipFile(THIS_FILE, 'r') as f: | 238 with zipfile.ZipFile(THIS_FILE, 'r') as f: |
| 239 logging.error('Files in %s:\n%s', THIS_FILE, f.namelist()) | 239 logging.error('Files in %s:\n%s', THIS_FILE, f.namelist()) |
| 240 return 1 | 240 return 1 |
| 241 | 241 |
| 242 print >> sys.stderr, 'Unknown command %s' % cmd | 242 print >> sys.stderr, 'Unknown command %s' % cmd |
| 243 return 1 | 243 return 1 |
| 244 | 244 |
| 245 | 245 |
| 246 if __name__ == '__main__': | 246 if __name__ == '__main__': |
| 247 sys.exit(main()) | 247 sys.exit(main()) |
| OLD | NEW |