dropshell release 2025.0518.1218
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
This commit is contained in:
parent
d0152c3ec7
commit
e7c6d38273
@ -6,6 +6,7 @@
|
||||
#include "server_env_manager.hpp"
|
||||
#include "services.hpp"
|
||||
#include "servers.hpp"
|
||||
#include "templates.hpp"
|
||||
|
||||
namespace dropshell
|
||||
{
|
||||
@ -53,6 +54,33 @@ namespace dropshell
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user