Skip to content

Commit 144d0dc

Browse files
committed
Remove usage of empty signing keys in developer_tool
Stop using empty signing keys lists for writing unsigned metadata as partially signed. Update tests accordingly. Signed-off-by: Teodora Sechkova <[email protected]>
1 parent ae0957c commit 144d0dc

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

tests/test_developer_tool.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,9 @@ def test_write(self):
348348
name_backup = project.project_name
349349

350350
# Write and reload.
351-
self.assertRaises(securesystemslib.exceptions.Error, project.write)
351+
self.assertRaises(tuf.exceptions.UnsignedMetadataError, project.write)
352+
project.load_signing_key(project_private_key)
353+
project('delegation').load_signing_key(delegation_private_key)
352354
project.write(write_partial=True)
353355

354356
project = developer_tool.load_project(local_tmp)

tuf/developer_tool.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,8 @@ def _generate_and_write_metadata(rolename, metadata_filename, write_partial,
479479
# written with write() / write_partial().
480480
# Increment the version number if this is the first partial write.
481481
if write_partial:
482-
temp_signable = repo_lib.sign_metadata(metadata, [], metadata_filename,
483-
repository_name)
484-
temp_signable['signatures'].extend(roleinfo['signatures'])
482+
temp_signable = repo_lib.sign_metadata(metadata, roleinfo['signing_keyids'],
483+
metadata_filename, repository_name)
485484
status = tuf.sig.get_signature_status(temp_signable, rolename,
486485
repository_name)
487486
if len(status['good_sigs']) == 0:

0 commit comments

Comments
 (0)