Fix logic
This commit is contained in:
parent
82185b89dc
commit
acb462d15e
@ -132,18 +132,14 @@ int restore(const std::vector<std::string> &args)
|
|||||||
}
|
}
|
||||||
std::cout << "Backup complete." << std::endl;
|
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
|
{ // 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);
|
env.run_remote_template_command(service_name, "restore", {local_backup_file_path}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// healthcheck the service
|
// 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 green_tick = "\033[32m✓\033[0m";
|
||||||
std::string red_cross = "\033[31m✗\033[0m";
|
std::string red_cross = "\033[31m✗\033[0m";
|
||||||
if (env.run_remote_template_command(service_name, "status", {}, false))
|
if (env.run_remote_template_command(service_name, "status", {}, false))
|
||||||
|
@ -22,9 +22,6 @@ fi
|
|||||||
# # Stop container before backup
|
# # Stop container before backup
|
||||||
bash ./uninstall.sh || die "Failed to uninstall service before restore"
|
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
|
# Remove existing data folder
|
||||||
echo "Deleting ALL data in $LOCAL_DATA_FOLDER."
|
echo "Deleting ALL data in $LOCAL_DATA_FOLDER."
|
||||||
rm -rf "$LOCAL_DATA_FOLDER"
|
rm -rf "$LOCAL_DATA_FOLDER"
|
||||||
|
@ -9,8 +9,8 @@ source "$(dirname "$0")/_common.sh"
|
|||||||
check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
|
check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
|
||||||
|
|
||||||
_remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER_NAME}"
|
_remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER_NAME}"
|
||||||
_is_container_running || die "Couldn't stop existing container"
|
_is_container_running && die "Couldn't stop existing container"
|
||||||
_is_container_exists || die "Couldn't remove existing container"
|
_is_container_exists && die "Couldn't remove existing container"
|
||||||
|
|
||||||
# remove the image
|
# remove the image
|
||||||
docker rmi "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || echo "Failed to remove image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
|
docker rmi "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || echo "Failed to remove image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user