ADD: added some details to error logs
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
#include "curlpp/Options.hpp"
|
||||
#include "kubecontrol/PodInfo.hpp"
|
||||
#include "nlohmann/json_fwd.hpp"
|
||||
#include <cstddef>
|
||||
@@ -94,17 +95,20 @@ namespace kubecontrol
|
||||
return response;
|
||||
}
|
||||
|
||||
std::string PodController::getPodsInfo( )
|
||||
std::string PodController::getPodsInfo()
|
||||
{
|
||||
|
||||
std::string curlURL = ServerAddress_+ApiCall_;
|
||||
|
||||
auto response = this->performRequest(curlURL);
|
||||
std::string response = this->performRequest(curlURL);
|
||||
|
||||
|
||||
std::vector<std::string> podsNames;
|
||||
nlohmann::json j;
|
||||
try
|
||||
{
|
||||
|
||||
auto j = nlohmann::json::parse(response);
|
||||
j = nlohmann::json::parse(response);
|
||||
|
||||
if (j.contains("items"))
|
||||
{
|
||||
@@ -114,6 +118,7 @@ namespace kubecontrol
|
||||
if (!j["items"][a]["metadata"]["name"].empty())
|
||||
{
|
||||
podsNames.emplace_back(j["items"][a]["metadata"]["name"]);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,11 +135,18 @@ namespace kubecontrol
|
||||
|
||||
|
||||
return j.dump();
|
||||
|
||||
}catch(const std::exception e)
|
||||
{
|
||||
LOG_S(ERROR)<< e.what()<< " IN PodController::getPodsInfo() Function";
|
||||
}
|
||||
return j.dump();
|
||||
}
|
||||
|
||||
|
||||
std::string PodController::getInfoForPod(std::string Label)
|
||||
{
|
||||
|
||||
bool found = false;
|
||||
for (auto item : PodList_)
|
||||
{
|
||||
@@ -144,6 +156,7 @@ namespace kubecontrol
|
||||
checkPodsHierarchy();
|
||||
item.InfoPod = *getPodInfo(item.getUUID()).get();
|
||||
LOG_S(INFO)<<item.InfoPod.getRelatedPods().size();
|
||||
|
||||
return item.getInfo(ServerAddress_+ApiCall_, BearerToken_);
|
||||
|
||||
}
|
||||
@@ -207,7 +220,7 @@ namespace kubecontrol
|
||||
|
||||
} catch (std::exception& e)
|
||||
{
|
||||
LOG_S(ERROR)<<e.what();
|
||||
LOG_S(ERROR)<<e.what() << " In checkPodsHierarchy() Function";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -242,7 +255,7 @@ namespace kubecontrol
|
||||
|
||||
if (podsInfoList_[i]->Uuid == uuid)
|
||||
{
|
||||
return podsInfoList_[i];
|
||||
return podsInfoList_[i];
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
@@ -280,6 +293,7 @@ namespace kubecontrol
|
||||
WriterMemoryClass mWriterChunk;
|
||||
curlpp::types::WriteFunctionFunctor functor = std::bind(&WriterMemoryClass::WriteMemoryCallback, &mWriterChunk, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
||||
curlpp::options::WriteFunction *test = new curlpp::options::WriteFunction(functor);
|
||||
|
||||
request->setOpt(test);
|
||||
|
||||
request->setOpt(new curlpp::options::HttpHeader(headers));
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace kubecontrol
|
||||
} catch (std::exception& e)
|
||||
{
|
||||
// LOG_S(WARNING)<< response;
|
||||
LOG_S(ERROR)<<e.what();
|
||||
LOG_S(ERROR)<<e.what() << " IN PodInfo Constructor";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user