Fix logic

This commit is contained in:
John 2025-04-27 20:26:39 +12:00
parent 82185b89dc
commit acb462d15e
3 changed files with 4 additions and 11 deletions

View File

@ -132,18 +132,14 @@ int restore(const std::vector<std::string> &args)
}
std::cout << "Backup complete." << std::endl;
}
{ // silently uninstalling the current service
std::cout << "2) Uninstalling current service..." << std::endl;
env.run_remote_template_command(service_name, "uninstall", {}, false);
}
{ // restore service from backup
std::cout << "3) Restoring service from backup..." << std::endl;
std::cout << "2) Restoring service from backup..." << std::endl;
env.run_remote_template_command(service_name, "restore", {local_backup_file_path}, false);
}
// healthcheck the service
std::cout << "4) Healthchecking service..." << std::endl;
std::cout << "3) Healthchecking service..." << std::endl;
std::string green_tick = "\033[32m✓\033[0m";
std::string red_cross = "\033[31m✗\033[0m";
if (env.run_remote_template_command(service_name, "status", {}, false))

View File

@ -22,9 +22,6 @@ fi
# # Stop container before backup
bash ./uninstall.sh || die "Failed to uninstall service before restore"
_is_container_running && die "Container still running after uninstall"
_is_container_exists && die "Container still exists after uninstall"
# Remove existing data folder
echo "Deleting ALL data in $LOCAL_DATA_FOLDER."
rm -rf "$LOCAL_DATA_FOLDER"

View File

@ -9,8 +9,8 @@ source "$(dirname "$0")/_common.sh"
check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
_remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER_NAME}"
_is_container_running || die "Couldn't stop existing container"
_is_container_exists || die "Couldn't remove existing container"
_is_container_running && die "Couldn't stop existing container"
_is_container_exists && die "Couldn't remove existing container"
# remove the image
docker rmi "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || echo "Failed to remove image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"