mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Remove call to roledb.get_parent_rolename() in load_repository
Add all encountered delegated roles to the top-level targets object. For example:
'django' role delegated by 'unclaimed' (which in turn was delgated by 'targets') is available at repository.targets('unclaimed')
This commit is contained in:
parent
b9c085114a
commit
4cb34c45a6
1 changed files with 4 additions and 5 deletions
|
|
@ -2810,11 +2810,10 @@ def load_repository(repository_directory):
|
|||
tuf.roledb.update_roleinfo(metadata_name, roleinfo)
|
||||
loaded_metadata.append(metadata_name)
|
||||
|
||||
# Generate the Targets objects of the delegated roles of
|
||||
# 'metadata_name' and update the parent role Targets object.
|
||||
# Generate the Targets objects of the delegated roles of 'metadata_name'
|
||||
# and add it to the top-level 'targets' object.
|
||||
new_targets_object = Targets(targets_directory, metadata_name, roleinfo)
|
||||
targets_object = \
|
||||
targets_objects[tuf.roledb.get_parent_rolename(metadata_name)]
|
||||
targets_object = targets_objects['targets']
|
||||
targets_objects[metadata_name] = new_targets_object
|
||||
|
||||
targets_object._delegated_roles[(os.path.basename(metadata_name))] = \
|
||||
|
|
@ -2836,7 +2835,7 @@ def load_repository(repository_directory):
|
|||
pass
|
||||
|
||||
# Add the delegated role's initial roleinfo, to be fully populated
|
||||
# when its metadata file is next loaded in the os.walk() iteration.
|
||||
# when its metadata file is next loaded in one of the next iterations.
|
||||
for role in metadata_object['delegations']['roles']:
|
||||
rolename = role['name']
|
||||
roleinfo = {'name': role['name'], 'keyids': role['keyids'],
|
||||
|
|
|
|||
Loading…
Reference in a new issue