Reading some attributes of a delegated targets role after loading a repository throws a KeyError
See original GitHub issueDescription of issue or feature request:
After loading a repository, reading the threshold of a delegated targets role throws a KeyError
.
Current behavior:
- Create a new repository with a delegated targets role.
- Load the repository.
- Try to read the threshold of this delegated targets role:
(Pdb) delegated_targets_role.threshold
*** KeyError: 'threshold'
- Try to read the keys of this delegated targets role:
File "/usr/lib/python3.6/site-packages/tuf/repository_tool.py", line 1008, in keys
keyids = roleinfo['keyids']
KeyError: 'keyids'
Expected behavior:
Should return the threshold / keys of the delegated targets role. I suspect this is due to missing assignments [1].
Ideally, the fix should include checking the schema of the delegated targets role after assignments.
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (16 by maintainers)
Top Results From Across the Web
Reading some attributes of a delegated targets role after ...
Description of issue or feature request: After loading a repository, reading the threshold of a delegated targets role throws a KeyError . Current...
Read more >Python KeyError Exceptions and How to Handle Them
Python's official documentation says that the KeyError is raised when a mapping key is accessed and isn't found in the mapping.
Read more >KeyError caused by a wrong attribute assignment within the ...
After the creation of your graph: G = nx.from_pandas_edgelist(filtered, 'Source', 'Target', edge_attr=True) df_pos = nx.spring_layout(G,k ...
Read more >All other Tokyo fixes - Product Documentation | ServiceNow
Console error for users without roles or any active assessments or surveys to take, when navigating to the My Assessments and Surveys module....
Read more >API Reference — fsspec 2022.11.0+13.g0974514.dirty ...
To read from multiple files you can pass a globstring or a list of paths, ... will be regarded as missing keys and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Should we add a wrapper for this?
repository.get_roleinfo("rolename")
? The returned dict should contain all of the metadata fields you’d want.Asking about the
threshold
andkeyids
of a delegated role (e.g.,my_role.threshold
) is complicated by the fact thatmy_role
can be a delegation of more than one role. For instance,foo
can delegate tomy_role
some paths with a threshold of X and keyids A, B, C. Thebar
role can also delegate tomy_role
some different paths with a threshold of Y and keyids D, E.So when you give the
my_role.threshold
query, which value do you expect?my_role.threshold
was actually a thing in the past, back when delegations resembled a tree rather than a graph. I suppose it’s clear which value is meant viarepository.targets.foo.my_role.threshold
. Unfortunately, it was decided that this command was unweildy, so it was replaced by, for example,repository.targets("my_role").delegate()
andrepository.targets("foo").version = 2
).What should the interface be to modify a delegation?
Is this good?
Hopefully we can settle on a design that doesn’t negatively impact code maintainability and my well being 😃
FYI: I think you can still give a
repository.targets.threshold
. It is allowed because there is a definitive value.