Skip to content

Commit 79f4f41

Browse files
author
Jussi Kukkonen
committed
Metadata: Improve DelegatedRole docstring
Explain the ways a delegation can happen: Do not try to cover the complete process (specification should do that) but offer enough details that the complexity is not completely hidden from the viewer. Signed-off-by: Jussi Kukkonen <[email protected]>
1 parent 38b6d44 commit 79f4f41

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tuf/api/metadata.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -848,17 +848,21 @@ def update(self, rolename: str, role_info: MetaFile) -> None:
848848

849849

850850
class DelegatedRole(Role):
851-
"""A container with information about particular delegated role.
851+
"""A container with information about a delegated role.
852+
853+
A delegation can happen in three ways:
854+
- paths is None and path_hash_prefixes is None: delegates all targets
855+
- paths is set: delegates targets matching any path pattern in paths
856+
- path_hash_prefixes is set: delegates targets whose target path hash
857+
starts with any of the prefixes in path_hash_prefixes
858+
paths and path_hash_prefixes are mutually exclusive: both cannot be set.
852859
853860
Attributes:
854861
name: A string giving the name of the delegated role.
855862
terminating: A boolean indicating whether subsequent delegations
856863
should be considered during a target lookup.
857-
paths: An optional list of strings, where each string describes
858-
a path pattern that the role is trusted to provide.
859-
path_hash_prefixes: An optional list of HEX_DIGESTs used to succinctly
860-
describe a set of target paths. Only one of the attributes "paths"
861-
and "path_hash_prefixes" is allowed within a DelegatedRole.
864+
paths: An optional list of path pattern strings. See note above.
865+
path_hash_prefixes: An optional list of hash prefixes. See note above.
862866
unrecognized_fields: Dictionary of all unrecognized fields.
863867
"""
864868

0 commit comments

Comments
 (0)