Not working yet.
This commit is contained in:
parent
986b9be2b4
commit
dbbb0af459
@ -12,6 +12,12 @@ bool server_env::is_valid() const {
|
||||
}
|
||||
|
||||
server_env::server_env(const std::string& server_name) : mValid(false) {
|
||||
if (server_name.empty())
|
||||
{
|
||||
std::cerr << "Warning: Server name is empty, passed to server_env constructor." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// Construct the full path to server.env
|
||||
std::string env_path = get_local_server_env_path(server_name);
|
||||
|
||||
|
@ -38,10 +38,8 @@ std::vector<ServiceInfo> get_server_services_info(const std::string& server_name
|
||||
ServiceInfo get_service_info(const std::string &server_name, const std::string &service_name)
|
||||
{
|
||||
std::string service_dir = get_local_service_path(server_name, service_name);
|
||||
if (service_dir.empty()) {
|
||||
std::cerr << "Error: Service directory not found: " << service_dir << std::endl;
|
||||
if (service_dir.empty())
|
||||
return ServiceInfo();
|
||||
}
|
||||
|
||||
ServiceInfo service;
|
||||
std::string local_service_env_path = get_local_service_env_path(server_name, service_name);
|
||||
@ -74,6 +72,9 @@ std::set<std::string> get_used_commands(const std::string &server_name, const st
|
||||
{
|
||||
std::set<std::string> commands;
|
||||
|
||||
if (server_name.empty() || service_name.empty())
|
||||
return commands;
|
||||
|
||||
ServiceInfo service = get_service_info(server_name, service_name);
|
||||
if (service.template_path.empty()) {
|
||||
std::cerr << "Error: Service not found: " << service_name << std::endl;
|
||||
|
@ -41,32 +41,31 @@ std::string get_local_config_path()
|
||||
std::string get_local_config_templates_path()
|
||||
{
|
||||
std::string config_path = get_local_config_path();
|
||||
if (config_path.empty()) {
|
||||
if (config_path.empty())
|
||||
return std::string();
|
||||
}
|
||||
return config_path + "/templates";
|
||||
}
|
||||
|
||||
std::string get_local_config_servers_path()
|
||||
{
|
||||
std::string config_path = get_local_config_path();
|
||||
if (config_path.empty()) {
|
||||
if (config_path.empty())
|
||||
return std::string();
|
||||
}
|
||||
return config_path + "/servers";
|
||||
}
|
||||
|
||||
std::string get_local_config_backups_path()
|
||||
{
|
||||
std::string config_path = get_local_config_path();
|
||||
if (config_path.empty()) {
|
||||
if (config_path.empty())
|
||||
return std::string();
|
||||
}
|
||||
return config_path + "/backups";
|
||||
}
|
||||
|
||||
std::string get_local_server_path(const std::string &server_name)
|
||||
{
|
||||
if (server_name.empty())
|
||||
return std::string();
|
||||
std::string config_path = get_local_config_path();
|
||||
if (config_path.empty())
|
||||
return std::string();
|
||||
@ -75,6 +74,8 @@ std::string get_local_server_path(const std::string &server_name)
|
||||
|
||||
std::string get_local_server_env_path(const std::string &server_name)
|
||||
{
|
||||
if (server_name.empty())
|
||||
return std::string();
|
||||
std::string serverpath = get_local_server_path(server_name);
|
||||
if (serverpath.empty())
|
||||
return std::string();
|
||||
@ -83,6 +84,9 @@ std::string get_local_server_env_path(const std::string &server_name)
|
||||
|
||||
std::string get_local_service_path(const std::string &server_name, const std::string &service_name)
|
||||
{
|
||||
if (server_name.empty() || service_name.empty())
|
||||
return std::string();
|
||||
|
||||
std::string serverpath = get_local_server_path(server_name);
|
||||
if (serverpath.empty())
|
||||
return std::string();
|
||||
@ -91,6 +95,8 @@ std::string get_local_service_path(const std::string &server_name, const std::st
|
||||
|
||||
std::string get_local_service_env_path(const std::string &server_name, const std::string &service_name)
|
||||
{
|
||||
if (server_name.empty() || service_name.empty())
|
||||
return std::string();
|
||||
std::string servicepath = get_local_service_path(server_name, service_name);
|
||||
if (servicepath.empty())
|
||||
return std::string();
|
||||
@ -111,6 +117,8 @@ std::string get_local_service_env_path(const std::string &server_name, const std
|
||||
|
||||
std::string get_remote_DROPSHELL_path(const std::string &server_name)
|
||||
{
|
||||
if (server_name.empty())
|
||||
return std::string();
|
||||
server_env env(server_name);
|
||||
if (!env.is_valid())
|
||||
return std::string();
|
||||
@ -119,6 +127,8 @@ std::string get_local_service_env_path(const std::string &server_name, const std
|
||||
|
||||
std::string get_remote_service_path(const std::string &server_name, const std::string &service_name)
|
||||
{
|
||||
if (server_name.empty() || service_name.empty())
|
||||
return std::string();
|
||||
std::string dropshell_path = get_remote_DROPSHELL_path(server_name);
|
||||
if (dropshell_path.empty())
|
||||
return std::string();
|
||||
@ -127,6 +137,8 @@ std::string get_local_service_env_path(const std::string &server_name, const std
|
||||
|
||||
std::string get_remote_service_config_path(const std::string &server_name, const std::string &service_name)
|
||||
{
|
||||
if (server_name.empty() || service_name.empty())
|
||||
return std::string();
|
||||
std::string service_path = get_remote_service_path(server_name, service_name);
|
||||
if (service_path.empty())
|
||||
return std::string();
|
||||
@ -135,6 +147,8 @@ std::string get_local_service_env_path(const std::string &server_name, const std
|
||||
|
||||
std::string get_remote_service_template_path(const std::string &server_name, const std::string &service_name)
|
||||
{
|
||||
if (server_name.empty() || service_name.empty())
|
||||
return std::string();
|
||||
std::string service_path = get_remote_service_path(server_name, service_name);
|
||||
if (service_path.empty())
|
||||
return std::string();
|
||||
@ -143,6 +157,8 @@ std::string get_local_service_env_path(const std::string &server_name, const std
|
||||
|
||||
std::string get_remote_service_backups_path(const std::string &server_name, const std::string &service_name)
|
||||
{
|
||||
if (server_name.empty() || service_name.empty())
|
||||
return std::string();
|
||||
std::string service_path = get_remote_service_path(server_name, service_name);
|
||||
if (service_path.empty())
|
||||
return std::string();
|
||||
@ -151,6 +167,8 @@ std::string get_local_service_env_path(const std::string &server_name, const std
|
||||
|
||||
std::string get_remote_service_env_file(const std::string &server_name, const std::string &service_name)
|
||||
{
|
||||
if (server_name.empty() || service_name.empty())
|
||||
return std::string();
|
||||
std::string service_path = get_remote_service_config_path(server_name, service_name);
|
||||
if (service_path.empty())
|
||||
return std::string();
|
||||
|
Loading…
x
Reference in New Issue
Block a user