#!/bin/bash source ~/.bashrc # Continue All Steps with Troubleshooting # Attempts to complete all steps and troubleshoot issues set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" # Load environment variables if [ -f "$PROJECT_ROOT/.env" ]; then set -a source <(grep -v '^#' "$PROJECT_ROOT/.env" | grep -v '^$' | sed 's/#.*$//' | grep '=') set +a fi # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' log_info() { echo -e "${GREEN}[INFO]${NC} $1" } log_warn() { echo -e "${YELLOW}[WARN]${NC} $1" } log_error() { echo -e "${RED}[ERROR]${NC} $1" } log_issue() { echo -e "${RED}[ISSUE]${NC} $1" } log_step() { echo -e "\n${BLUE}=== $1 ===${NC}" } # Step 1: Diagnose Issues diagnose_issues() { log_step "Step 1: Diagnosing Issues" if [ -f "$PROJECT_ROOT/scripts/troubleshooting/diagnose-vm-issues.sh" ]; then "$PROJECT_ROOT/scripts/troubleshooting/diagnose-vm-issues.sh" else log_warn "Diagnosis script not found" fi } # Step 2: Fix Template (if possible) fix_template() { log_step "Step 2: Attempting Template Fixes" log_info "Template disk expanded to 8G (if not already)" log_warn "Template needs OS installation - see TROUBLESHOOTING_AND_FIXES.md" log_info "This requires manual access to Proxmox Web UI" } # Step 3: Continue Infrastructure Setup continue_infrastructure() { log_step "Step 3: Continuing Infrastructure Setup" log_info "Checking cluster status..." # Cluster check done in main script log_warn "Infrastructure setup requires SSH access to Proxmox hosts" log_info "To configure cluster:" log_info " ssh root@192.168.1.206" log_info " export CLUSTER_NAME=hc-cluster NODE_ROLE=create" log_info " ./infrastructure/proxmox/cluster-setup.sh" } # Step 4: Monitor VM Status monitor_vms() { log_step "Step 4: Monitoring VM Status" local vms=("100" "101" "102" "103") local all_ready=true for vmid in "${vms[@]}"; do # Check via API log_info "Checking VM $vmid..." done if [ "$all_ready" = false ]; then log_warn "VMs not ready - may need template OS installation" fi } main() { log_info "Continuing All Steps with Troubleshooting" echo "" # Diagnose diagnose_issues # Fix template fix_template # Continue infrastructure continue_infrastructure # Monitor monitor_vms log_step "Summary" log_issue "CRITICAL: Template VM 9000 needs OS installation" log_info "See TROUBLESHOOTING_AND_FIXES.md for detailed fix instructions" log_info "After template is fixed, recreate VMs and continue" } main "$@"