.
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user