[gclient] Fix setdep when GCS object condition is set

If an object has condition set, gclient setdep fails with a KeyError
exception. This change allowlists properties that can change during
the setdep operation.

R=kimstephanie@google.com

Change-Id: Icde3a1c0ff3d9e7c5a4560147e8baddad397ccd6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5532302
Reviewed-by: Stephanie Kim <kimstephanie@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
changes/02/5532302/2
Josip Sokcevic 1 year ago committed by LUCI CQ
parent 6a7597cf9a
commit e6a370ee1d

@ -812,8 +812,13 @@ def SetGCS(gclient_dict, dep_name, new_objects):
raise ValueError("Number of revision objects must match the current "
"number of objects.")
# Allow only `keys_to_update` to be updated.
keys_to_update = ('object_name', 'sha256sum', 'size_bytes', 'generation',
'output_file')
for index, object_node in enumerate(objects_node.elts):
for key, value in zip(object_node.keys, object_node.values):
if key.s not in keys_to_update:
continue
_UpdateAstString(tokens, value, new_objects[index][key.s])
node.SetNode('objects', new_objects, objects_node)

Loading…
Cancel
Save