-
Notifications
You must be signed in to change notification settings - Fork 278
load_repository() does not load correctly Targets objects of delegated roles #1045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Excellent work, @sechkova! Out of curiosity I just compared # following repository.writeall() from above snippet (probably taken from the tutorial) ...
import tuf.roledb
import copy, pprint, dictdiffer, operator # NOTE: dictdiffer is 3rd-party
from tuf.repository_tool import *
# Backup roledb (state after constructing metadata)
roledb_dict_backup = copy.deepcopy(tuf.roledb._roledb_dict)
tuf.roledb.clear_roledb()
# Re-populate roledb from files on disk
repository = load_repository(repository._repository_directory)
# Diff them using 3rd-party dictdiffer tool and pretty print
diff_results = dictdiffer.diff(roledb_dict_backup, tuf.roledb._roledb_dict)
pprint.pprint(sorted(diff_results, key=operator.itemgetter(0)))
# Check https://dictdiffer.readthedocs.io/ for docs about the format of the result |
Yes, exactly, what I described concerns the "class-based" metadata representation. Roledb metadata is loaded (mostly) correctly in this case. |
This was resolved in #1052 |
Description of issue:
When a repository is loaded from the filesystem by
repository_tool.load_repository()
, delegated roles' objects are missing from the delegating role.Steps to reproduce:
Create a longer chain of delegations, for example delegate to hashed bins (the same issue applies to any other delegation):
Check the length of the delegations:
Load the created repository from disk:
Current behavior:
Loaded delegated roles' objects are missing from the delegating object if the role is not the top-level 'targets' role.
Expected behavior:
After loading from filesystem, the delegated roles are added to the delegating role's
_delegated_roles
list.The text was updated successfully, but these errors were encountered: