Skip to content
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

ngclient: Fail gracefully on missing role #2197

Merged
merged 1 commit into from
Dec 16, 2022

Conversation

jku
Copy link
Member

@jku jku commented Nov 28, 2022

If role is delegated but missing from snapshot, we currently raise a undocumented KeyError: a generic RepositoryError seems better as callers are expected to handle it (and adding a more specific error seems useless as this is a repository software bug, not just expired metadata or something).

The same check is also done later in TrustedMetadataSet but I think keeping the check in both is clearest.

Fixes #2195

Signed-off-by: Jussi Kukkonen [email protected]


  • The code follows the Code Style Guidelines
  • Tests have been added for the bug fix or new feature
  • Docs have been added for the bug fix or new feature

If role is delegated but missing from snapshot, we currently raise a
undocumented KeyError: a generic RepositoryError seems better as callers
are expected to handle it (and adding a more specific error seems
useless as this is a repository software bug, not just expired metadata or
something).

The same check is also done later in TrustedMetadataSet but I think
keeping the check in both is clearest.

Fixes theupdateframework#2195

Signed-off-by: Jussi Kukkonen <[email protected]>
@coveralls
Copy link

Pull Request Test Coverage Report for Build 3563389019

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 98.194%

Totals Coverage Status
Change from base Build 3548721600: 0.005%
Covered Lines: 1349
Relevant Lines: 1365

💛 - Coveralls

@jku jku marked this pull request as ready for review November 30, 2022 07:45
Copy link
Member

@lukpueh lukpueh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lukpueh lukpueh merged commit c6f8b58 into theupdateframework:develop Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ngclient should cope better with broken repos
3 participants