feat: Update 3 files
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Successful in 50s
Build-Test-Publish / build (linux/arm64) (push) Has been cancelled

This commit is contained in:
Your Name
2025-08-31 16:24:57 +12:00
parent a0f541efcf
commit 52606513ff
3 changed files with 28 additions and 12 deletions

View File

@@ -49,8 +49,7 @@ namespace dropshell
namespace shared_commands namespace shared_commands
{ {
bool destroy_service_remote(const std::string &server, const std::string &service)
bool destroy_service(const std::string &server, const std::string &service)
{ {
ServerConfig server_env(server); ServerConfig server_env(server);
@@ -120,6 +119,11 @@ namespace dropshell
else else
error << "No valid local server information for server " << server << std::endl; error << "No valid local server information for server " << server << std::endl;
return true;
}
bool destroy_service_local(const std::string &server, const std::string &service)
{
// step 2 - destroy the local service directory, if it exists. // step 2 - destroy the local service directory, if it exists.
std::string local_service_path = localpath::service(server, service); std::string local_service_path = localpath::service(server, service);
if (local_service_path.empty() || !std::filesystem::exists(local_service_path)) if (local_service_path.empty() || !std::filesystem::exists(local_service_path))
@@ -134,11 +138,20 @@ namespace dropshell
else else
info << "Local service directory removed: " << local_service_path << std::endl; info << "Local service directory removed: " << local_service_path << std::endl;
} }
info << "Finished destroying service " << service << " on server " << server << std::endl;
return true; return true;
} }
bool destroy_service(const std::string &server, const std::string &service)
{
if (!destroy_service_remote(server, service))
return false;
if (!destroy_service_local(server, service))
return false;
info << "Finished destroying service " << service << " on server " << server << std::endl;
return true;
}
} // namespace shared_commands } // namespace shared_commands
int destroy_handler(const CommandContext &ctx) int destroy_handler(const CommandContext &ctx)

View File

@@ -186,16 +186,17 @@ namespace dropshell
} }
{ // Destroy the old service { // Destroy the old service
info << "2) Destroying old service..." << std::endl; info << "2) Destroying old remote service..." << std::endl;
if (!shared_commands::destroy_service(server, service)) if (!shared_commands::destroy_service_remote(server, service))
return 1; return 1;
info << "Remote service destroyed." << std::endl;
} }
{ // create the new service // { // create the new service
info << "3) Creating new service..." << std::endl; // info << "3) Creating new service..." << std::endl;
if (!shared_commands::create_service(server, service_info.template_name, service, service_info.user)) // if (!shared_commands::create_service(server, service_info.template_name, service, service_info.user))
return 1; // return 1;
} // }
{ // installing fresh service { // installing fresh service
info << "4) Install of fresh service..." << std::endl; info << "4) Install of fresh service..." << std::endl;

View File

@@ -104,6 +104,8 @@ namespace dropshell
bool uninstall_service(const ServerConfig &server_env, const std::string &service); bool uninstall_service(const ServerConfig &server_env, const std::string &service);
// defined in destroy.cpp // defined in destroy.cpp
bool destroy_service_remote(const std::string &server, const std::string &service);
bool destroy_service_local(const std::string &server, const std::string &service);
bool destroy_service(const std::string &server, const std::string &service); bool destroy_service(const std::string &server, const std::string &service);
// defined in install.cpp // defined in install.cpp