Store the last failed zone stage sync validation as runtime ApiListener attribute

This commit is contained in:
Michael Friedrich 2018-09-28 11:08:58 +02:00
parent a91bbe8acd
commit fb367e12cc
3 changed files with 20 additions and 1 deletions

View File

@ -385,7 +385,12 @@ void ApiListener::TryActivateZonesStageCallback(const ProcessResult& pr,
} else { } else {
Log(LogCritical, "ApiListener") Log(LogCritical, "ApiListener")
<< "Config validation failed for staged cluster config sync. Aborting. Logs: '" << "Config validation failed for staged cluster config sync. Aborting. Logs: '"
<< GetApiZonesStageDir() + "/startup.log'"; << logFile << "'";
ApiListener::Ptr listener = ApiListener::GetInstance();
if (listener)
listener->UpdateLastFailedZonesStageValidation(pr.Output);
} }
} }
@ -416,3 +421,13 @@ void ApiListener::AsyncTryActivateZonesStage(const String& stageConfigDir, const
process->SetTimeout(300); process->SetTimeout(300);
process->Run(std::bind(&TryActivateZonesStageCallback, _1, stageConfigDir, currentConfigDir, relativePaths, reload)); process->Run(std::bind(&TryActivateZonesStageCallback, _1, stageConfigDir, currentConfigDir, relativePaths, reload));
} }
void ApiListener::UpdateLastFailedZonesStageValidation(const String& log)
{
Dictionary::Ptr lastFailedZonesStageValidation = new Dictionary({
{ "log", log },
{ "ts", Utility::GetTime() }
});
SetLastFailedZonesStageValidation(lastFailedZonesStageValidation);
}

View File

@ -187,6 +187,8 @@ private:
static void AsyncTryActivateZonesStage(const String& stageConfigDir, const String& currentConfigDir, static void AsyncTryActivateZonesStage(const String& stageConfigDir, const String& currentConfigDir,
const std::vector<String>& relativePaths, bool reload); const std::vector<String>& relativePaths, bool reload);
void UpdateLastFailedZonesStageValidation(const String& log);
/* configsync */ /* configsync */
void UpdateConfigObject(const ConfigObject::Ptr& object, const MessageOrigin::Ptr& origin, void UpdateConfigObject(const ConfigObject::Ptr& object, const MessageOrigin::Ptr& origin,
const JsonRpcConnection::Ptr& client = nullptr); const JsonRpcConnection::Ptr& client = nullptr);

View File

@ -54,6 +54,8 @@ class ApiListener : ConfigObject
[state, no_user_modify] Timestamp log_message_timestamp; [state, no_user_modify] Timestamp log_message_timestamp;
[no_user_modify] String identity; [no_user_modify] String identity;
[state, no_user_modify] Dictionary::Ptr last_failed_zones_stage_validation;
}; };
} }