Compare commits

..

2 Commits

Author SHA1 Message Date
e7c6d38273 dropshell release 2025.0518.1218
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
2025-05-18 12:18:43 +12:00
d0152c3ec7 dropshell release 2025.0518.1150
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
2025-05-18 11:50:23 +12:00
2 changed files with 31 additions and 2 deletions

View File

@ -7,6 +7,7 @@
#include "tableprint.hpp" #include "tableprint.hpp"
#include "transwarp.hpp" #include "transwarp.hpp"
#include "server_env_manager.hpp" #include "server_env_manager.hpp"
#include "services.hpp"
#include <unistd.h> #include <unistd.h>
#include <cstring> #include <cstring>
@ -161,7 +162,7 @@ void show_server_details(const std::string& server_name) {
// list services, and run healthcheck on each // list services, and run healthcheck on each
{ {
tableprint tp("Services: " + server_name, false); tableprint tp("Services: " + server_name, false);
tp.add_row({"Status", "Service", "Ports"}); tp.add_row({"Status", "Service", "Template","Ports"});
std::map<std::string, shared_commands::ServiceStatus> status = shared_commands::get_all_services_status(server_name); std::map<std::string, shared_commands::ServiceStatus> status = shared_commands::get_all_services_status(server_name);
@ -175,7 +176,7 @@ void show_server_details(const std::string& server_name) {
for (const auto& port : service_status.ports) for (const auto& port : service_status.ports)
ports_str += std::to_string(port) + " "; ports_str += std::to_string(port) + " ";
tp.add_row({healthy, service_name, ports_str}); tp.add_row({healthy, service_name, get_service_info(server_name,service_name).template_name, ports_str});
} // end of for (const auto& service : services) } // end of for (const auto& service : services)
tp.print(); tp.print();
} // end of list services } // end of list services

View File

@ -6,6 +6,7 @@
#include "server_env_manager.hpp" #include "server_env_manager.hpp"
#include "services.hpp" #include "services.hpp"
#include "servers.hpp" #include "servers.hpp"
#include "templates.hpp"
namespace dropshell namespace dropshell
{ {
@ -53,6 +54,33 @@ namespace dropshell
bool ssh_into_service(const std::string &server, const std::string &service) bool ssh_into_service(const std::string &server, const std::string &service)
{ {
server_env_manager server_env(server);
if (!server_env.is_valid())
{
std::cerr << "Error: Server " << server << " is not valid" << std::endl;
return false;
}
LocalServiceInfo sinfo = get_service_info(server, service);
if (!SIvalid(sinfo))
{
std::cerr << "Error: Service " << service << " is not valid" << std::endl;
return false;
}
if (!gTemplateManager().has_template(sinfo.template_name))
{
std::cerr << "Error: Template " << sinfo.template_name << " is not valid" << std::endl;
return false;
}
if (!gTemplateManager().template_command_exists(sinfo.template_name, "ssh"))
{
std::cerr << "Error: Template " << sinfo.template_name << " does not have an ssh command" << std::endl;
return false;
}
server_env.run_remote_template_command(service,"ssh",{},false,{}); // explicitly supports interactive ssh!
return true; return true;
} }