1 #include "aktualizr_secondary_metadata.h"
3 Metadata::Metadata(Uptane::MetaBundle meta_bundle_in) : meta_bundle_(std::move(meta_bundle_in)) {
4 director_root_version_ =
Uptane::Version(Uptane::extractVersionUntrusted(
5 Uptane::getMetaFromBundle(meta_bundle_, Uptane::RepositoryType::Director(), Uptane::Role::Root())));
7 Uptane::getMetaFromBundle(meta_bundle_, Uptane::RepositoryType::Image(), Uptane::Role::Root())));
14 getRoleMetadata(
result, repo, role, version);
29 if (repo == Uptane::RepositoryType::Director() && director_root_version_ < version) {
30 LOG_DEBUG <<
"Requested Director root version " << version <<
" but only version " << director_root_version_
32 throw std::runtime_error(
"Metadata not found");
33 }
else if (repo == Uptane::RepositoryType::Image() && image_root_version_ < version) {
34 LOG_DEBUG <<
"Requested Image repo root version " << version <<
" but only version " << image_root_version_
36 throw std::runtime_error(
"Metadata not found");
40 *
result = Uptane::getMetaFromBundle(meta_bundle_, repo, role);