Aug 20th update

This commit is contained in:
Ned Wright
2024-08-21 08:42:14 +00:00
parent ca31aac08a
commit 110f0c8bd2
13 changed files with 155 additions and 15 deletions

View File

@@ -117,6 +117,7 @@ public:
OrchestrationStatusResult getOrchestrationStatusResult() const;
std::string parseDescription() const;
std::string getDescriptionWithoutErrors() const;
private:
UpdatesProcessResult result;

View File

@@ -556,7 +556,7 @@ TEST_F(OrchestrationStatusTest, checkErrorByRaiseEvent)
"Time",
"Online upgrades",
fog_address,
"Failed. Reason: Registration failed. Error: " + registar_error,
"Failed. Reason: Registration failed.",
"Failed. Reason: " + manifest_error
),
result

View File

@@ -473,7 +473,11 @@ public:
void
upon(const UpdatesProcessEvent &event) override
{
setFieldStatus(event.getStatusFieldType(), event.getOrchestrationStatusResult(), event.parseDescription());
setFieldStatus(
event.getStatusFieldType(),
event.getOrchestrationStatusResult(),
event.getDescriptionWithoutErrors()
);
}
private:

View File

@@ -122,3 +122,62 @@ UpdatesProcessEvent::parseDescription() const
}
return err.str();
}
string
UpdatesProcessEvent::getDescriptionWithoutErrors() const
{
stringstream err;
if (description.empty() || result == UpdatesProcessResult::SUCCESS) return "";
switch (reason) {
case UpdatesFailureReason::CHECK_UPDATE: {
err << description;
break;
}
case UpdatesFailureReason::REGISTRATION: {
err << "Registration failed.";
break;
}
case UpdatesFailureReason::GET_UPDATE_REQUEST: {
err << "Failed to get update request.";
break;
}
case UpdatesFailureReason::DOWNLOAD_FILE : {
err << "Failed to download the file " << detail;
break;
}
case UpdatesFailureReason::HANDLE_FILE : {
err << "Failed to handle the file " << detail;
break;
}
case UpdatesFailureReason::INSTALLATION_QUEUE : {
err << "Installation queue creation failed.";
break;
}
case UpdatesFailureReason::INSTALL_PACKAGE : {
err << "Failed to install the package " << detail;
break;
}
case UpdatesFailureReason::CHECKSUM_UNMATCHED : {
err << "Checksums do not match for the file: " << detail;
break;
}
case UpdatesFailureReason::POLICY_CONFIGURATION : {
err << "Failed to configure policy version: " << detail;
break;
}
case UpdatesFailureReason::POLICY_FOG_CONFIGURATION : {
err << "Failed to configure the fog address: " << detail;
break;
}
case UpdatesFailureReason::ORCHESTRATION_SELF_UPDATE : {
err << description;
break;
}
case UpdatesFailureReason::NONE : {
err << description;
break;
}
}
return err.str();
}