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

Improve docs on secondary root rotation #118

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/libaktualizr/uptane/uptanerepository.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ class RepositoryCommon {

/**
* Load the initial state of the repository from storage.
* Note that this _required_ for correct initialization.
* Note that this _required_ for correct initialization. The API here is
* particularly error prone and should be improved:
Comment on lines +30 to +31
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's is a verb missing in the first sentence, but otherwise, thanks, this is great and really makes the point.

* - Until this is called the root will have a policy kRejectAll (i.e. no
* updates are possible). It is therefore part of the initialization
* process and so should be moved to the ctor.
* - It throws an exception in a non-exceptional case: where the metadata
* in the storage has expired.
* - When it throws an exception, it changes the state and actually does
* perform initialization, therefore violating the Strong Exception
* Guarantee.
* @throws UptaneException if the local metadata is stale (this is not a failure)
*/
virtual void checkMetaOffline(INvStorage &storage) = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/virtual_secondary/managedsecondary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ ManagedSecondary::ManagedSecondary(Primary::ManagedSecondaryConfig sconfig_in) :
director_repo_->checkMetaOffline(*storage_);
} catch (const std::exception &e) {
// This is actually safe. We've done enough initialization to get
// director_repo_ into a valid configuration
// director_repo_ into a valid configuration. See the documentation for
// RepositoryCommon::checkMetaOffline() for details.
LOG_INFO << "No valid Director metadata found in storage: " << e.what();
}
try {
Expand Down
Loading