Skip to content

Commit b490ee7

Browse files
committed
Quickfix #883 (WIP)
Signed-off-by: Lukas Puehringer <[email protected]>
1 parent 4ad65e2 commit b490ee7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tuf/repository_lib.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,23 @@ def should_write():
234234
if rolename == 'root':
235235
filename = write_metadata_file(signable, metadata_filename,
236236
metadata['version'], consistent_snapshot=True)
237-
238237
else:
239238
filename = write_metadata_file(signable, metadata_filename,
240239
metadata['version'], consistent_snapshot)
241240

242-
return signable, filename
243241

242+
# If we got so far `write_metadata_file` must have been called successfully.
243+
# If we wrote root metadata, we reset the `previous_keyids` and
244+
# `previous_threshold` fields on roleinfo,
245+
# FIXME: This is a quick fix for theupdateframework/tuf#883 and will be fixed
246+
# properly with theupdateframework/tuf#864.
247+
if rolename == 'root':
248+
roleinfo['previous_keyids'] = []
249+
roleinfo['previous_threshold'] = []
250+
tuf.roledb.update_roleinfo(rolename, roleinfo,
251+
repository_name=repository_name)
244252

253+
return signable, filename
245254

246255

247256

0 commit comments

Comments
 (0)