simplified instructions
This commit is contained in:
@@ -3,44 +3,93 @@
|
||||
## Overview
|
||||
In this exercise, you'll learn how to authenticate with the Zerto API using Keycloak. You'll create a client and establish a connection to your ZVM.
|
||||
|
||||
## Objectives
|
||||
- Create a Keycloak client
|
||||
- Configure authentication parameters
|
||||
- Test the connection to ZVM
|
||||
- Handle authentication errors
|
||||
## What You'll Learn
|
||||
- How to create a ZVMLClient object (your "remote control" for ZVM)
|
||||
- How to connect to your Zerto Virtual Manager
|
||||
- How to test if the connection works
|
||||
- How to handle errors if something goes wrong
|
||||
|
||||
## Time
|
||||
10 minutes
|
||||
|
||||
## Prerequisites
|
||||
- Completed Exercise 1
|
||||
- Valid ZVM credentials
|
||||
- Client ID and secret
|
||||
- ✅ Completed Exercise 1
|
||||
- ✅ Valid ZVM credentials (IP address, client ID, client secret)
|
||||
- ✅ Updated `prerequisites/config.py` with your details
|
||||
|
||||
## Exercise Steps
|
||||
1. Set up your configuration
|
||||
2. Create the Keycloak client
|
||||
3. Test the connection
|
||||
4. Handle authentication errors
|
||||
## Step-by-Step Instructions
|
||||
|
||||
### Step 1: Open the Working File
|
||||
1. Navigate to `exercises/02_authentication/working/`
|
||||
2. Open `auth.py` in your code editor
|
||||
3. Read through the detailed comments - they explain everything!
|
||||
|
||||
### Step 2: Complete the Code
|
||||
The file has three main sections you need to complete:
|
||||
|
||||
1. **Create ZVMLClient** - Replace `client = None` with actual code
|
||||
2. **Test Connection** - Add code to test if it works
|
||||
3. **Success Message** - Add a final success message
|
||||
|
||||
### Step 3: Run Your Code
|
||||
```bash
|
||||
cd exercises/02_authentication/working/
|
||||
python auth.py
|
||||
```
|
||||
|
||||
### Step 4: Check the Results
|
||||
- ✅ **Success**: You'll see "Connection successful!" and ZVM version info
|
||||
- ❌ **Error**: Check the error message and review your config.py
|
||||
|
||||
## Working Directory
|
||||
The `working` directory contains:
|
||||
- `auth.py` - Template to complete
|
||||
- `auth.py` - **Beginner-friendly template** with detailed instructions
|
||||
|
||||
## Solution
|
||||
The `solution` directory contains:
|
||||
- `auth.py` - Complete working example
|
||||
- `auth.py` - Complete working example (check this if you get stuck!)
|
||||
|
||||
## Key Concepts
|
||||
- Keycloak authentication
|
||||
- Client credentials flow
|
||||
- Error handling
|
||||
- Connection management
|
||||
## Key Concepts Explained
|
||||
|
||||
## Common Issues
|
||||
- Invalid credentials
|
||||
- SSL certificate issues
|
||||
- Network connectivity problems
|
||||
### What is ZVMLClient?
|
||||
- Think of it as a "remote control" for your Zerto Virtual Manager
|
||||
- It handles all the communication between your Python code and ZVM
|
||||
- You need to give it your ZVM address and login credentials
|
||||
|
||||
### What is Keycloak?
|
||||
- It's the authentication system that Zerto uses
|
||||
- You create a "client" (like a username) and get a "secret" (like a password)
|
||||
- The ZVMLClient uses these to log into your ZVM
|
||||
|
||||
### What is SSL Verification?
|
||||
- It's a security check to make sure you're connecting to the right server
|
||||
- Usually set to `False` for Zerto (self-signed certificates)
|
||||
|
||||
## Common Issues & Solutions
|
||||
|
||||
### ❌ "Configuration file not found"
|
||||
**Solution**: Copy `prerequisites/config.example.py` to `prerequisites/config.py`
|
||||
|
||||
### ❌ "Authentication failed"
|
||||
**Solutions**:
|
||||
- Check your ZVM_HOST is correct
|
||||
- Verify your CLIENT_ID and CLIENT_SECRET
|
||||
- Make sure your ZVM is running and accessible
|
||||
|
||||
### ❌ "SSL certificate" errors
|
||||
**Solution**: Make sure `ZVM_SSL_VERIFY = False` in your config.py
|
||||
|
||||
### ❌ "Connection refused" or "Network unreachable"
|
||||
**Solutions**:
|
||||
- Check your ZVM IP address is correct
|
||||
- Make sure you can ping the ZVM from your computer
|
||||
- Check firewall settings
|
||||
|
||||
## Need Help?
|
||||
1. Read the detailed comments in the code
|
||||
2. Check the solution file
|
||||
3. Review your `config.py` settings
|
||||
4. Ask your Zerto administrator for help with credentials
|
||||
|
||||
## Next Steps
|
||||
Proceed to Exercise 3: Site Discovery to start working with Zerto sites.
|
||||
Once you successfully connect, proceed to **Exercise 3: Site Discovery** to start working with Zerto sites.
|
||||
Reference in New Issue
Block a user