Add general check for a cbuildbot config.
BUG=chromium-os:29916
TEST=submit local and remote jobs with/without configs.
Change-Id: I6cc024c5187ac2c2d7db27148fe57a2780fc12f7
Reviewed-on: https://gerrit.chromium.org/gerrit/20963
Reviewed-by: Ryan Cui <rcui@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
Commit-Ready: Ryan Cui <rcui@chromium.org>
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index eea6b53..370cb0a 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -907,13 +907,17 @@
def _ParseCommandLine(parser, argv):
"""Completely parse the commandline arguments"""
(options, args) = parser.parse_args(argv)
- # Strip out null arguments.
- # TODO(rcui): Remove when buildbot is fixed
- args = [arg for arg in args if arg]
if options.list:
_PrintValidConfigs(options.print_all)
sys.exit(0)
+ # Strip out null arguments.
+ # TODO(rcui): Remove when buildbot is fixed
+ args = [arg for arg in args if arg]
+ if not args:
+ parser.error('Invalid usage. Use -h to see usage. Use -l to list '
+ 'supported configs.')
+
_FinishParsing(options, args)
return options, args
@@ -956,12 +960,9 @@
'local trybot.')
time.sleep(5)
- if args:
- # Only expecting one config
- bot_id = args[-1]
- build_config = _GetConfig(bot_id)
- else:
- parser.error('Invalid usage. Use -h to see usage.')
+ # Only expecting one config
+ bot_id = args[-1]
+ build_config = _GetConfig(bot_id)
if options.reference_repo is None:
repo_path = os.path.join(constants.SOURCE_ROOT, '.repo')