Pulp CLI

0.39.0 · active · verified Thu Apr 16

Pulp CLI is a command-line interface for managing Pulp 3 resources and interacting with Pulpcore's REST API. It serves as a client for various Pulp plugins (e.g., pulp_ansible, pulp_file, pulp_rpm) to perform tasks like listing repositories, synchronizing content, and managing distributions. Currently at version 0.39.0, the library is under active development, and its status is considered 'beta', implying that future releases may introduce backwards-incompatible changes.

Common errors

Warnings

Install

Quickstart

The Pulp CLI requires initial configuration to connect to a Pulp 3 server. This typically involves setting the base URL, username, and password, which can be done via `pulp config create` or environment variables. After configuration, you can verify the connection with `pulp status` and interact with various Pulp resources.

import os

# Configure Pulp CLI. This creates or updates ~/.config/pulp/cli.toml
# In a real scenario, avoid hardcoding credentials. Use environment variables or a .netrc file.
# Example using environment variables:
# export PULP_BASE_URL="http://localhost:8080"
# export PULP_USERNAME="admin"
# export PULP_PASSWORD="password"

base_url = os.environ.get('PULP_BASE_URL', 'http://localhost:8080')
username = os.environ.get('PULP_USERNAME', 'admin')
password = os.environ.get('PULP_PASSWORD', 'password')

# This command is meant to be run in a shell, not directly via Python subprocess
# For demonstration, it's shown as a shell command.
print(f"Setting up Pulp CLI configuration for {base_url}...")
print(f"pulp config create --base-url {base_url} --username {username} --password {password}")

# To verify connection and list available repositories
print("\nVerifying Pulp server status:")
print("pulp status")

print("\nListing file repositories (example):")
print("pulp file repository list")

# To see full help for a command:
print("\nTo view full help for the 'pulp' command:")
print("pulp --help")

view raw JSON →