Remove debug logging, fix ticket path, enhance logging

refs #5450
This commit is contained in:
Michael Friedrich 2017-09-07 16:07:35 +02:00 committed by Gunnar Beutner
parent 043106242d
commit 501ade374c
1 changed files with 5 additions and 9 deletions

View File

@ -216,10 +216,10 @@ delayed_request:
JsonRpcConnection::SendCertificateRequest(JsonRpcConnection::Ptr(), origin, requestPath);
result->Set("status_code", 2);
result->Set("error", "Certificate request is pending. Waiting for approval from the parent Icinga instance.");
result->Set("error", "Certificate request for CN '" + cn + "' is pending. Waiting for approval from the parent Icinga instance.");
Log(LogInformation, "JsonRpcConnection")
<< "Certificate request is pending. Waiting for approval.";
<< "Certificate request for CN '" << cn << "' is pending. Waiting for approval.";
return result;
}
@ -240,7 +240,7 @@ void JsonRpcConnection::SendCertificateRequest(const JsonRpcConnection::Ptr& acl
/* Path is empty if this is our own request. */
if (path.IsEmpty()) {
String ticketPath = Application::GetLocalStateDir() + "/lib/icinga2/pki/ticket";
String ticketPath = ApiListener::GetCertsDir() + "/ticket";
std::ifstream fp(ticketPath.CStr());
String ticket((std::istreambuf_iterator<char>(fp)), std::istreambuf_iterator<char>());
@ -275,9 +275,6 @@ Value UpdateCertificateHandler(const MessageOrigin::Ptr& origin, const Dictionar
return Empty;
}
Log(LogWarning, "JsonRpcConnection")
<< params->ToString();
String ca = params->Get("ca");
String cert = params->Get("cert");
@ -315,8 +312,6 @@ Value UpdateCertificateHandler(const MessageOrigin::Ptr& origin, const Dictionar
String requestDir = ApiListener::GetCertificateRequestsDir();
String requestPath = requestDir + "/" + certFingerprint + ".json";
std::cout << requestPath << "\n";
/* Save the received signed certificate request to disk. */
if (Utility::PathExists(requestPath)) {
Log(LogInformation, "JsonRpcConnection")
@ -385,7 +380,8 @@ Value UpdateCertificateHandler(const MessageOrigin::Ptr& origin, const Dictionar
}
/* Update the certificates at runtime and reconnect all endpoints. */
Log(LogInformation, "JsonRpcConnection", "Updating the client certificate at runtime and reconnecting the endpoints.");
Log(LogInformation, "JsonRpcConnection")
<< "Updating the client certificate for CN '" << cn << "' at runtime and reconnecting the endpoints.";
listener->UpdateSSLContext();
return Empty;