This commit is contained in:
Your Name
2025-04-25 18:54:31 +12:00
parent bbf2575718
commit d028a4d8c6
15 changed files with 195 additions and 15 deletions

View File

@ -11,6 +11,7 @@
#include <iomanip>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include <execution>
namespace fs = boost::filesystem;
@ -55,18 +56,20 @@ void list_servers() {
tableprint tp("All DropShell Servers");
tp.add_row({"Name", "Address", "Health", "Ports"});
for (const auto& server : servers) {
std::for_each(std::execution::par, servers.begin(), servers.end(), [&](const ServerInfo& server) {
std::vector<int> ports_used;
std::string serviceticks = "";
std::vector<ServiceInfo> services = get_server_services_info(server.name);
for (const auto& service : services) {
std::for_each(std::execution::par, services.begin(), services.end(), [&](const ServiceInfo& service) {
service_runner ss;
if (ss.init(server.name, service.service_name))
serviceticks += ss.healthmark() + " ";
else std::cout<<"Error: Failed to initialise service runner for server: ["<<server.name<<"] and service: ["<<service.service_name<<"]"<<std::endl;
std::vector<int> ports = ss.get_ports();
ports_used.insert(ports_used.end(), ports.begin(), ports.end());
}
});
// convert ports_used to string
std::string ports_used_str = "";
bool first = true;
@ -78,7 +81,7 @@ void list_servers() {
first = false;
}
tp.add_row({server.name, server.ssh_host, serviceticks, ports_used_str});
}
});
tp.print();
}