Skip to content

Commit

Permalink
Fix global error handling by iterating over the available module_name…
Browse files Browse the repository at this point in the history
…s instead of the trimmed down main conig that doesn't have this information anymore

Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
  • Loading branch information
hikinggrass committed Dec 6, 2024
1 parent de1a665 commit bffe376
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions include/utils/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ class ConfigBase {
/// \returns the module config cache
std::unordered_map<std::string, ConfigCache> get_module_config_cache();

///
/// \return the cached mapping of module ids to module names
std::unordered_map<std::string, std::string> get_module_names();

///
/// \brief checks if the given \p module_id provides the requirement given in \p requirement_id
///
Expand Down
4 changes: 4 additions & 0 deletions lib/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ std::unordered_map<std::string, ConfigCache> ConfigBase::get_module_config_cache
return this->module_config_cache;
}

std::unordered_map<std::string, std::string> ConfigBase::get_module_names() {
return this->module_names;
}

json ConfigBase::resolve_requirement(const std::string& module_id, const std::string& requirement_id) const {
BOOST_LOG_FUNCTION();

Expand Down
3 changes: 1 addition & 2 deletions lib/everest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,7 @@ void Everest::subscribe_global_all_errors(const error::ErrorCallback& callback,
clear_callback(error);
};

for (const std::string module_id : Config::keys(this->config.get_main_config())) {
const std::string module_name = this->config.get_module_name(module_id);
for (const auto& [module_id, module_name] : this->config.get_module_names()) {
const json provides = this->config.get_manifests().at(module_name).at("provides");
for (const auto& impl : provides.items()) {
const std::string impl_id = impl.key();
Expand Down

0 comments on commit bffe376

Please sign in to comment.