Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 4da300c5 authored by Micha Mueller's avatar Micha Mueller
Browse files

Minor improvements to RestAPI server

parent af62fd36
......@@ -183,9 +183,8 @@ void RESTHttpsServer::handle_request(http::request<Body>& req, Send&& send) {
res.body() = "Invalid endpoint\n";
}
#ifdef DEBUG
ServerLOG(info) << "Responding:\n" << res.body();
#endif
res.prepare_payload();
send(std::move(res));
return;
......
......@@ -28,14 +28,14 @@ RestAPI::RestAPI(serverSettings_t settings,
_manager(manager),
_io(io) {
addEndpoint("/help", {http::verb::get, stdBind(GET_help)});
addEndpoint("/plugins", {http::verb::get, stdBind(GET_plugins)});
addEndpoint("/sensors", {http::verb::get, stdBind(GET_sensors)});
addEndpoint("/average", {http::verb::get, stdBind(GET_average)});
addEndpoint("/help", {http::verb::get, stdBind(GET_help)});
addEndpoint("/plugins", {http::verb::get, stdBind(GET_plugins)});
addEndpoint("/sensors", {http::verb::get, stdBind(GET_sensors)});
addEndpoint("/average", {http::verb::get, stdBind(GET_average)});
addEndpoint("/start", {http::verb::put, stdBind(PUT_start)});
addEndpoint("/stop", {http::verb::put, stdBind(PUT_stop)});
addEndpoint("/reload", {http::verb::put, stdBind(PUT_reload)});
addEndpoint("/start", {http::verb::put, stdBind(PUT_start)});
addEndpoint("/stop", {http::verb::put, stdBind(PUT_stop)});
addEndpoint("/reload", {http::verb::put, stdBind(PUT_reload)});
_manager->addRestEndpoints(this);
......@@ -44,7 +44,7 @@ RestAPI::RestAPI(serverSettings_t settings,
}
void RestAPI::GET_help(endpointArgs) {
res.body() = restCheatSheet + _manager->newRestCheatSheet;
res.body() = restCheatSheet + _manager->restCheatSheet;
res.result(http::status::ok);
}
......@@ -108,9 +108,7 @@ void RestAPI::GET_average(endpointArgs) {
const std::string interval = getQuery("interval", queries);
if (plugin == "" || sensor == "") {
const std::string err = "Request malformed: plugin or sensor query missing";
RESTAPILOG(error) << err;
res.body() = err;
res.body() = "Request malformed: plugin or sensor query missing\n";
res.result(http::status::bad_request);
return;
}
......@@ -118,7 +116,14 @@ void RestAPI::GET_average(endpointArgs) {
uint64_t time = 0;
if (interval != "") {
time = std::stoul(interval);
try {
time = std::stoul(interval);
} catch (const std::exception& e) {
RESTAPILOG(warning) << "Bad interval query: " << e.what();
res.body() = "Bad interval query!\n";
res.result(http::status::bad_request);
return;
}
}
res.body() = "Plugin not found!\n";
......@@ -244,7 +249,7 @@ void RestAPI::PUT_reload(endpointArgs) {
removeTopics(p);
p.configurator->clearConfig();
} else {
res.body() = "Plugin " + plugin + ": Configuration reloaded\n";
res.body() = "Plugin " + plugin + ": Configuration reloaded.\n";
res.result(http::status::ok);
for (const auto& g : p.configurator->getSensorGroups()) {
g->init(_io);
......@@ -252,7 +257,7 @@ void RestAPI::PUT_reload(endpointArgs) {
}
}
} else {
res.body() = "Plugin " + plugin + ": Could not reload configuration";
res.body() = "Plugin " + plugin + ": Could not reload configuration.\n";
res.result(http::status::internal_server_error);
}
......@@ -305,9 +310,7 @@ bool RestAPI::checkTopics(dl_t p) {
void RestAPI::PUT_analytics_reload(endpointArgs) {
if (_manager->getStatus() != AnalyticsManager::LOADED) {
const std::string err = "AnalyticsManager is not loaded!\n";
RESTAPILOG(error) << err;
res.body() = err;
res.body() = "AnalyticsManager is not loaded!\n";
res.result(http::status::internal_server_error);
return;
}
......
......@@ -13,7 +13,6 @@
#include <boost/asio.hpp>
#include "includes/PluginDefinitions.h"
#include "globalconfiguration.h"
#include "../analytics/AnalyticsManager.h"
#include "mqttchecker.h"
#include "MQTTPusher.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment