Update source/src/commands/list.cpp
This commit is contained in:
@@ -235,8 +235,18 @@ void show_server_details(const std::string& server_name) {
|
||||
|
||||
// Try to connect to the server (using our improved timeout)
|
||||
bool is_online = execute_ssh_command(sshinfo, sCommand("", "true", {}), cMode::Silent);
|
||||
bool agent_match = false;
|
||||
std::map<std::string, shared_commands::ServiceStatus> service_status_map;
|
||||
|
||||
if (is_online) {
|
||||
info << "Status: Online" << std::endl;
|
||||
// Get all service status and agent match in one call
|
||||
service_status_map = shared_commands::get_all_services_status(env, &agent_match);
|
||||
if (agent_match) {
|
||||
info << "Agent: Up to date" << std::endl;
|
||||
} else {
|
||||
warning << "Agent: Out of date - run 'ds install " << server_name << "' to update" << std::endl;
|
||||
}
|
||||
} else {
|
||||
warning << "Status: Offline" << std::endl;
|
||||
}
|
||||
@@ -272,11 +282,7 @@ void show_server_details(const std::string& server_name) {
|
||||
tp.add_row({"Status", "Service", "Template","Ports"});
|
||||
|
||||
if (is_online) {
|
||||
std::map<std::string, shared_commands::ServiceStatus> status = shared_commands::get_all_services_status(server_name);
|
||||
|
||||
std::set<int> ports_used;
|
||||
std::string serviceticks = "";
|
||||
for (const auto& [service_name, service_status] : status) {
|
||||
for (const auto& [service_name, service_status] : service_status_map) {
|
||||
std::string healthy = shared_commands::HealthStatus2String(service_status.health);
|
||||
|
||||
std::string ports_str = "";
|
||||
@@ -288,7 +294,7 @@ void show_server_details(const std::string& server_name) {
|
||||
template_name = "Unknown";
|
||||
|
||||
tp.add_row({healthy, service_name, template_name, ports_str});
|
||||
} // end of for (const auto& service : services)
|
||||
}
|
||||
} else {
|
||||
// Server is offline, just list services without checking their status
|
||||
std::vector<LocalServiceInfo> services = get_server_services_info(server_name);
|
||||
|
||||
Reference in New Issue
Block a user