|
| 1 | +# Pulp CLI Console |
| 2 | + |
| 3 | +A command-line interface for Pulp, providing console administrative functionality. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | +- [Overview](#overview) |
| 7 | +- [Requirements](#requirements) |
| 8 | +- [Installation](#installation) |
| 9 | +- [Configuration](#configuration) |
| 10 | + - [Basic Configuration](#basic-configuration) |
| 11 | + - [Advanced Options](#advanced-options) |
| 12 | + - [Environment Variables](#environment-variables) |
| 13 | +- [Usage](#usage) |
| 14 | + - [Task Management](#task-management) |
| 15 | + - [Vulnerability Management](#vulnerability-management) |
| 16 | + - [Performance Monitoring](#performance-monitoring) |
| 17 | +- [Troubleshooting](#troubleshooting) |
| 18 | + - [Common Issues](#common-issues) |
| 19 | + - [Debug Mode](#debug-mode) |
| 20 | + - [Logs](#logs) |
| 21 | +- [Contributing](#contributing) |
| 22 | +- [License](#license) |
| 23 | + |
| 24 | +## Overview |
| 25 | + |
| 26 | +The Pulp CLI Console provides a set of commands to manage Pulp resources from the command line. It extends the base Pulp CLI functionality with console-specific administrative tools for system operators and administrators. |
| 27 | + |
| 28 | +The console offers capabilities for task management, vulnerability scanning, system monitoring, and more, all through a unified command-line interface. |
| 29 | + |
| 30 | +## Requirements |
| 31 | + |
| 32 | +- Python 3.8 or higher |
| 33 | +- Access to a Pulp 3.x server |
| 34 | +- Network connectivity to your Pulp server |
| 35 | +- Appropriate user permissions on the Pulp server |
| 36 | + |
| 37 | +## Installation |
| 38 | + |
| 39 | +You can install the Pulp CLI Console using pip: |
| 40 | + |
| 41 | +```bash |
| 42 | +pip install pulp-cli-console |
| 43 | +``` |
| 44 | + |
| 45 | +For development or the latest features, you can install directly from the repository: |
| 46 | + |
| 47 | +```bash |
| 48 | +pip install git+https://github.com/pulp/pulp-cli-console.git |
| 49 | +``` |
| 50 | + |
| 51 | +## Configuration |
| 52 | + |
| 53 | +### Basic Configuration |
| 54 | + |
| 55 | +The Pulp CLI Console requires configuration to connect to your Pulp server. Create a configuration file at `~/.config/pulp/cli.toml`: |
| 56 | + |
| 57 | +```toml |
| 58 | +[cli] |
| 59 | +base_url = "https://pulp.example.com" |
| 60 | +verify_ssl = true |
| 61 | +format = "json" |
| 62 | +timeout = 30 |
| 63 | +username = "admin" |
| 64 | +password = "password" # Consider using environment variables instead |
| 65 | +``` |
| 66 | + |
| 67 | +### Advanced Options |
| 68 | + |
| 69 | +You can customize various aspects of the CLI behavior: |
| 70 | + |
| 71 | +```toml |
| 72 | +[cli] |
| 73 | +base_url = "https://pulp.example.com" |
| 74 | +verify_ssl = true |
| 75 | +cert = "/path/to/client/cert.pem" # Optional client certificate |
| 76 | +key = "/path/to/client/key.pem" # Optional client key |
| 77 | +ca_cert = "/path/to/ca/cert.pem" # Custom CA certificate |
| 78 | +format = "json" # Output format: json, yaml, or none |
| 79 | +timeout = 60 # Request timeout in seconds |
| 80 | +limit = 100 # Default pagination limit |
| 81 | +interactive = true # Enable interactive prompts |
| 82 | +quiet = false # Suppress non-error output |
| 83 | +verbose = 0 # Verbosity level (0-3) |
| 84 | +# Use one of the following authentication methods |
| 85 | +username = "admin" |
| 86 | +password = "password" |
| 87 | +token = "your-api-token" # API token authentication |
| 88 | +refresh_token = "refresh-token" # For OAuth2 refresh token flow |
| 89 | +``` |
| 90 | + |
| 91 | +### Environment Variables |
| 92 | + |
| 93 | +You can also use environment variables for configuration, which is recommended for sensitive information: |
| 94 | + |
| 95 | +```bash |
| 96 | +# Base configuration |
| 97 | +export PULP_BASE_URL="https://pulp.example.com" |
| 98 | +export PULP_VERIFY_SSL="true" |
| 99 | + |
| 100 | +# Authentication |
| 101 | +export PULP_USERNAME="admin" |
| 102 | +export PULP_PASSWORD="password" |
| 103 | + |
| 104 | +# Alternative authentication |
| 105 | +export PULP_TOKEN="your-api-token" |
| 106 | +``` |
| 107 | + |
| 108 | +## Usage |
| 109 | + |
| 110 | +### Task Management |
| 111 | + |
| 112 | +The CLI provides commands for managing administrative tasks: |
| 113 | + |
| 114 | +```bash |
| 115 | +# List all tasks |
| 116 | +pulp console task list |
| 117 | + |
| 118 | +# Filter tasks by state |
| 119 | +pulp console task list --state=completed |
| 120 | + |
| 121 | +# List tasks with pagination |
| 122 | +pulp console task list --limit=10 --offset=20 |
| 123 | + |
| 124 | +# Filter tasks by name |
| 125 | +pulp console task list --name="sync" --name-contains="content" |
| 126 | + |
| 127 | +# Filter tasks by time |
| 128 | +pulp console task list --started-at-gte="2023-01-01T00:00:00Z" |
| 129 | + |
| 130 | +# Show detailed information for a specific task |
| 131 | +pulp console task show --href=/pulp/api/v3/tasks/1234abcd/ |
| 132 | + |
| 133 | +# Cancel a running task |
| 134 | +pulp console task cancel --href=/pulp/api/v3/tasks/1234abcd/ |
| 135 | +``` |
| 136 | + |
| 137 | +#### Available Filters for Tasks |
| 138 | + |
| 139 | +- `--limit`: Limit the number of tasks shown |
| 140 | +- `--offset`: Skip a number of tasks |
| 141 | +- `--name`: Filter by task name |
| 142 | +- `--name-contains`: Filter tasks containing this name |
| 143 | +- `--logging-cid-contains`: Filter by logging correlation ID |
| 144 | +- `--state`: Filter by task state |
| 145 | +- `--state-in`: Filter by multiple states (comma-separated) |
| 146 | +- `--task-group`: Filter by task group |
| 147 | +- `--parent-task`: Filter by parent task |
| 148 | +- `--worker`: Filter by worker |
| 149 | +- `--created-resources`: Filter by created resources |
| 150 | +- `--started-at-gte/--started-at-lte`: Filter by start time |
| 151 | +- `--finished-at-gte/--finished-at-lte`: Filter by finish time |
| 152 | +- `--reserved-resource/--reserved-resource-in`: Filter by reserved resources |
| 153 | +- `--exclusive-resource/--exclusive-resource-in`: Filter by exclusive resources |
| 154 | +- `--shared-resource/--shared-resource-in`: Filter by shared resources |
| 155 | + |
| 156 | +### Vulnerability Management |
| 157 | + |
| 158 | +The CLI provides commands for managing vulnerability reports: |
| 159 | + |
| 160 | +```bash |
| 161 | +# List vulnerability reports |
| 162 | +pulp console vulnerability list |
| 163 | + |
| 164 | +# Show a specific vulnerability report |
| 165 | +pulp console vulnerability show --href=/api/pulp/vulnerability-reports/123/ |
| 166 | + |
| 167 | +# Create a vulnerability report |
| 168 | +pulp console vulnerability create --file=/path/to/packages.json |
| 169 | +``` |
| 170 | + |
| 171 | +#### Vulnerability Commands |
| 172 | + |
| 173 | +- `list`: List all vulnerability reports |
| 174 | +- `show`: Display details of a specific vulnerability report |
| 175 | +- `create`: Create a new vulnerability report from a JSON file |
| 176 | + |
| 177 | +#### Options for Vulnerability Commands |
| 178 | + |
| 179 | +- `--href`: Reference to a specific vulnerability report (for show command) |
| 180 | +- `--file`: JSON file containing npm packages (required for create command) |
| 181 | +- `--chunk-size`: Size of chunks for uploading files (for create command) |
| 182 | +- `--severity`: Filter by vulnerability severity (critical, high, medium, low) |
| 183 | +- `--status`: Filter by status (open, in-progress, resolved, false-positive) |
| 184 | + |
| 185 | +### Performance Monitoring |
| 186 | + |
| 187 | +```bash |
| 188 | +# Get system performance metrics |
| 189 | +pulp console monitor performance |
| 190 | + |
| 191 | +# View resource utilization |
| 192 | +pulp console monitor resources |
| 193 | + |
| 194 | +# Check Pulp server health |
| 195 | +pulp console monitor health |
| 196 | +``` |
| 197 | + |
| 198 | +## Troubleshooting |
| 199 | + |
| 200 | +### Common Issues |
0 commit comments