mirror of
https://github.com/openappsec/openappsec.git
synced 2025-09-30 11:44:29 +03:00
Aug 20th update
This commit is contained in:
@@ -117,6 +117,7 @@ public:
|
||||
OrchestrationStatusResult getOrchestrationStatusResult() const;
|
||||
|
||||
std::string parseDescription() const;
|
||||
std::string getDescriptionWithoutErrors() const;
|
||||
|
||||
private:
|
||||
UpdatesProcessResult result;
|
||||
|
@@ -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
|
||||
|
@@ -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:
|
||||
|
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user