sculpt: gracefully handle missing depot-user info

This patch improves the error handling of depot-download manager for the
case where a download is requested but the corresponding software
provider information is absent from the depot. Without this patch, the
update mechanism would get stuck in the failed depot-query step and
won't attempt to perform subsequent download jobs.

Fixes #3224
This commit is contained in:
Norman Feske 2019-03-11 11:48:01 +01:00 committed by Christian Helmuth
parent 41575ad60d
commit 00eb100114
2 changed files with 32 additions and 1 deletions

View File

@ -306,6 +306,34 @@ void Depot_download_manager::Main::_handle_query_result()
_index.update();
_current_user.update();
/* validate completeness of depot-user info */
{
Xml_node const user = _current_user.xml();
Archive::User const name = user.attribute_value("name", Archive::User());
bool const user_info_complete = user.has_sub_node("url")
&& user.has_sub_node("pubkey");
if (name.valid() && !user_info_complete) {
/* discard jobs that lack proper depot-user info */
_jobs.for_each([&] (Job &job) {
if (Archive::user(job.path) == name)
job.failed = true; });
/*
* Don't attempt importing content for an unknown user.
* Instead, trigger the depot query for the next pending job.
*/
if (name == _next_user) {
_next_user = Archive::User();
_generate_init_config();
return;
}
}
}
Xml_node const dependencies = _dependencies.xml();
Xml_node const index = _index.xml();

View File

@ -579,7 +579,10 @@ void Depot_query::Main::_query_user(Archive::User const &user, Xml_generator &xm
});
}
catch (Directory::Nonexistent_file) {
warning("incomplete or missing depot-user info for '", user, "'"); }
warning("incomplete depot-user info for '", user, "'"); }
catch (Directory::Nonexistent_directory) {
warning("missing depot-user info for '", user, "'"); }
}