# Nutanix LCM Darksite Bundles Downloader

## Overview
The Nutanix LCM Darksite Bundles Downloader (`Nutanix_LCM_Darksite_Bundles_Downloader.py`) is an automated tool designed to download required upgrade bundles for exported upgrade selections from the Nutanix portal using secure API authentication.

## System Requirements

### Prerequisites
- Python 3.8 or higher
- Active internet connection
- Valid Nutanix portal account with API access
- Sufficient disk space for downloaded bundles

### Platform Support
| Platform    | Script    |
|-------------|-----------|
| Linux/macOS | `run.sh`  |
| Windows     | `run.bat` |

## Setup Instructions

### Step 1: API Credential Configuration
Before proceeding, you must obtain valid API credentials from the Nutanix portal.

1. Navigate to [my.nutanix.com](https://my.nutanix.com)
2. Access the **API Key Management** section
3. Create a new API key with the following configuration:
   - **Scope**: Prism Central/Element
   - **Sub-Scope**: LCM darksite bundles
4. Securely store both the API key and key ID for future use

### Step 2: Environment Validation
Navigate to the extracted directory and verify your Python installation. If the python version is not valid please install a version >=3.8 before proceeding further.

**Linux/macOS:**
```
bash
./run.sh --validate_python_version
```

**Windows:**
```
cmd
.\run.bat --validate_python_version
```

### Step 3: Automated Setup and Execution
While in the extracted directory, execute the appropriate run script for your platform.

**Linux/macOS:**
```
bash
./run.sh
```

**Windows:**
```
cmd
.\run.bat
```

**Automated Process:**
The setup script will perform the following operations:
- Create an isolated Python virtual environment
- Install all required dependencies from `requirements.txt`
- Launch the Nutanix LCM Darksite Bundles Downloader

### Step 4: Bundle Download Process
Upon successful setup completion, the downloader will launch automatically. Follow the interactive prompts to:
- Provide path to the YAML file or press enter for the default path
- Enter your API credentials
- Specify number of parallel downloads to be performed
- Monitor download progress

### Step 5: Download Verification
Verify that all required bundles have been successfully downloaded. If any files are missing, you may need to:
- Retry the download process
- Manually download missing files from the [Nutanix Portal](https://portal.nutanix.com/page/downloads/)

### Step 6: Deployment
Transfer all downloaded bundles to your darksite/airgapped environment and upload them to the Nutanix LCM service running on Prism Central.

## Troubleshooting

### Common Issues and Solutions

**Python Not Found**
- Ensure Python 3.8+ is installed and added to your system PATH
- Verify installation: `python --version` (Windows) or `python3 --version` (Linux/macOS)

**Virtual Environment Creation Failure**
- Verify you have sufficient file system permissions
- Ensure adequate disk space is available
- Check that Python virtual environment module is installed

**Package Installation Failure**
- Verify internet connectivity and DNS resolution
- Check proxy settings and firewall configurations
- Ensure PyPI repository access is not blocked

**Windows PowerShell Execution Policy Issues**
- Run PowerShell as Administrator
- Execute: `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser`
- Restart your command prompt/PowerShell session

**API Authentication Errors**
- Verify API key and key ID are correctly entered
- Ensure API key has not expired
- Confirm the API key scope includes LCM darksite bundles

## Support
For additional assistance, consult the Nutanix documentation or contact Nutanix Support through the official channels.