Commit 8820ab85 authored by Mike Frysinger's avatar Mike Frysinger Committed by LUCI CQ

gerrit_client: validate --param options

Passing an invalid --param option in leads to a crash lower down in
the gerrit modules which can be hard to trace back to the original
error: the user forgot the "key" in the "key=value".

Change-Id: I6fe5fab0fad15cf8d25173e0f1c8ea130efc44ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2558651Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
parent 295dd187
......@@ -46,6 +46,8 @@ def CMDmovechanges(parser, args):
(opt, args) = parser.parse_args(args)
assert opt.destination_branch, "--destination_branch not defined"
for p in opt.params:
assert '=' in p, '--param is key=value, not "%s"' % p
host = urlparse.urlparse(opt.host).netloc
limit = 100
......@@ -108,6 +110,8 @@ def CMDchanges(parser, args):
'(starting with the most recent)')
(opt, args) = parser.parse_args(args)
for p in opt.params:
assert '=' in p, '--param is key=value, not "%s"' % p
result = gerrit_util.QueryChanges(
urlparse.urlparse(opt.host).netloc,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment