feat: Update 3 files
This commit is contained in:
@@ -49,8 +49,7 @@ namespace dropshell
|
||||
|
||||
namespace shared_commands
|
||||
{
|
||||
|
||||
bool destroy_service(const std::string &server, const std::string &service)
|
||||
bool destroy_service_remote(const std::string &server, const std::string &service)
|
||||
{
|
||||
ServerConfig server_env(server);
|
||||
|
||||
@@ -120,6 +119,11 @@ namespace dropshell
|
||||
else
|
||||
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.
|
||||
std::string local_service_path = localpath::service(server, service);
|
||||
if (local_service_path.empty() || !std::filesystem::exists(local_service_path))
|
||||
@@ -134,11 +138,20 @@ namespace dropshell
|
||||
else
|
||||
info << "Local service directory removed: " << local_service_path << std::endl;
|
||||
}
|
||||
|
||||
info << "Finished destroying service " << service << " on server " << server << std::endl;
|
||||
|
||||
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
|
||||
|
||||
int destroy_handler(const CommandContext &ctx)
|
||||
|
@@ -186,16 +186,17 @@ namespace dropshell
|
||||
}
|
||||
|
||||
{ // Destroy the old service
|
||||
info << "2) Destroying old service..." << std::endl;
|
||||
if (!shared_commands::destroy_service(server, service))
|
||||
info << "2) Destroying old remote service..." << std::endl;
|
||||
if (!shared_commands::destroy_service_remote(server, service))
|
||||
return 1;
|
||||
info << "Remote service destroyed." << std::endl;
|
||||
}
|
||||
|
||||
{ // create the new service
|
||||
info << "3) Creating new service..." << std::endl;
|
||||
if (!shared_commands::create_service(server, service_info.template_name, service, service_info.user))
|
||||
return 1;
|
||||
}
|
||||
// { // create the new service
|
||||
// info << "3) Creating new service..." << std::endl;
|
||||
// if (!shared_commands::create_service(server, service_info.template_name, service, service_info.user))
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
{ // installing fresh service
|
||||
info << "4) Install of fresh service..." << std::endl;
|
||||
|
@@ -104,6 +104,8 @@ namespace dropshell
|
||||
bool uninstall_service(const ServerConfig &server_env, const std::string &service);
|
||||
|
||||
// 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);
|
||||
|
||||
// defined in install.cpp
|
||||
|
Reference in New Issue
Block a user