This commit is contained in:
Your Name 2025-05-05 23:18:00 +12:00
parent b4b237c1b7
commit 42e25b6353
2 changed files with 10 additions and 4 deletions

View File

@ -234,6 +234,12 @@ bool service_runner::run_command(const std::string& command, std::vector<std::st
if (command == "fullnuke")
return fullnuke();
if (command == "nuke")
{
std::cout << "Nuking " << mService << " (" << mServiceInfo.template_name << ") on " << mServer << std::endl;
return nuke();
}
if (!gTemplateManager().template_command_exists(mServiceInfo.template_name, command)) {
std::cout << "No command script for " << mServiceInfo.template_name << " : " << command << std::endl;
return true; // nothing to run.
@ -247,25 +253,25 @@ bool service_runner::run_command(const std::string& command, std::vector<std::st
// Check if service directory exists
if (!mServerEnv.check_remote_dir_exists(remotepath::service(mServer, mService))) {
std::cerr << "Error: Service is not installed: " << mService << std::endl;
return false;
}
// Check if command script exists
if (!mServerEnv.check_remote_file_exists(script_path)) {
std::cerr << "Error: Remote command script not found: " << script_path << std::endl;
return false;
}
// Check if env file exists
if (!mServerEnv.check_remote_file_exists(remotefile::service_env(mServer, mService))) {
std::cerr << "Error: Service config file not found: " << remotefile::service_env(mServer, mService) << std::endl;
return false;
}
if (command == "uninstall")
return uninstall();
if (command == "nuke")
return nuke();
if (command == "ssh") {
interactive_ssh_service();
return true;

View File

@ -45,7 +45,7 @@ _autocommandrun_path() {
PATHPARENT=$(dirname ${path})
PATHCHILD=$(basename ${path})
if [ -d "${PATHPARENT}/${PATHCHILD}" ]; then
docker run --rm -v ${PATHPARENT}:/volume debian bash -c "rm -rf /volume/${PATHCHILD}"
docker run --rm -v ${PATHPARENT}:/volume debian bash -c "rm -rf /volume/${PATHCHILD}" || echo "Failed to nuke path ${path}"
else
echo "Path ${path} does not exist - nothing to nuke"
fi