{"id":8454,"library":"pulp-glue-deb","title":"Pulp Glue DEB","description":"pulp-glue-deb is a Python glue library designed to provide a version-agnostic interface for interacting with the Pulpcore REST API, specifically for managing Debian (DEB) content. It abstracts away version-specific API changes, allowing developers to write more resilient code. The current version is 0.4.3, and it receives regular updates, typically a few releases per year, indicating active maintenance.","status":"active","version":"0.4.3","language":"en","source_language":"en","source_url":"https://github.com/pulp/pulp-glue-deb","tags":["pulp","deb","debian","repository","api-client","glue"],"install":[{"cmd":"pip install pulp-glue-deb","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Provides the foundational PulpConnection and core API interaction logic for all pulp-glue libraries. pulp-glue-deb depends directly on it.","package":"pulp-glue-core","optional":false}],"imports":[{"note":"PulpConnection is part of the core glue library, not specific content plugins like deb.","wrong":"from pulp_glue_deb.connection import PulpConnection","symbol":"PulpConnection","correct":"from pulp_glue_core.connection import PulpConnection"},{"note":"This provides access to DEB-specific API clients and functions.","symbol":"api","correct":"from pulp_glue_deb.app.deb import api as deb_api"},{"note":"Direct import for the DEB client if you prefer not to use the 'api' alias.","symbol":"DebClient","correct":"from pulp_glue_deb.app.deb.api import DebClient"}],"quickstart":{"code":"import os\nfrom pulp_glue_core.connection import PulpConnection\nfrom pulp_glue_deb.app.deb import api as deb_api\n\n# Get Pulp API URL and credentials from environment variables\nPULP_API_URL = os.environ.get('PULP_API_URL', 'http://localhost:8080/pulp/api/v3/')\nPULP_USERNAME = os.environ.get('PULP_USERNAME', 'admin')\nPULP_PASSWORD = os.environ.get('PULP_PASSWORD', 'password')\n\ntry:\n    # 1. Establish connection to Pulp\n    # Set verify_ssl=True in production and ensure valid certificates\n    connection = PulpConnection(\n        PULP_API_URL,\n        username=PULP_USERNAME,\n        password=PULP_PASSWORD,\n        verify_ssl=False # WARNING: Do not use False in production with untrusted CAs\n    )\n    print(f\"Connected to Pulp at {PULP_API_URL}\")\n\n    # 2. Get the DEB API client\n    deb_client = deb_api.DebClient(connection)\n\n    # 3. Create a DEB repository\n    repo_name = \"my-test-deb-repo\"\n    repo_description = \"A test Debian repository created via pulp-glue-deb.\"\n\n    # Check if repository already exists to avoid creation error\n    existing_repos = deb_client.list_repositories(name=repo_name)\n    if existing_repos:\n        repo = existing_repos[0]\n        print(f\"Repository '{repo_name}' already exists (Pulp Href: {repo['pulp_href']}).\")\n    else:\n        repo = deb_client.create_repository(\n            name=repo_name,\n            description=repo_description\n        )\n        print(f\"Successfully created DEB repository: {repo['name']} (Pulp Href: {repo['pulp_href']})\")\n\n    # Optional: Delete the created repository\n    # deb_client.delete_repository(repo['pulp_href'])\n    # print(f\"Deleted repository '{repo_name}'.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Ensure Pulpcore with the 'deb' plugin is running and accessible. Also verify environment variables PULP_API_URL, PULP_USERNAME, PULP_PASSWORD are set correctly.\")\n","lang":"python","description":"This quickstart demonstrates how to establish a connection to a Pulpcore server and create a new Debian repository using `pulp-glue-deb`. It uses environment variables for Pulp API credentials and gracefully handles pre-existing repositories."},"warnings":[{"fix":"Ensure `pulp_deb` is installed and enabled on your Pulpcore server instance. Refer to the Pulp documentation for plugin installation instructions.","message":"Pulpcore content plugins (e.g., `pulp_deb`) must be installed and enabled on the target Pulpcore server for pulp-glue-deb functionality to work. Without it, you'll encounter 404 or 400 errors when trying to use DEB-specific APIs.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review the release notes for `pulp-glue-deb` and `pulpcore` before upgrading. Test compatibility in a non-production environment.","message":"While `pulp-glue` aims to be version-agnostic, significant breaking changes in the underlying Pulpcore REST API can still lead to incompatibility. Always check the release notes for `pulp-glue-deb` and `pulpcore` when performing major upgrades.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For production, set `verify_ssl=True` and ensure your Python environment trusts the certificate authority that signed your Pulpcore server's SSL certificate.","message":"The `PulpConnection` often uses `verify_ssl=False` in quickstarts for local development. This is insecure and should NEVER be used in production with untrusted certificate authorities. Always verify SSL certificates.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Verify that `PULP_API_URL`, `PULP_USERNAME`, and `PULP_PASSWORD` environment variables (or direct parameters) are correctly set. Ensure the Pulpcore server is running and reachable from where the client code is executed.","cause":"Incorrect Pulp API URL, wrong username/password, or the Pulp server is not running or accessible with the provided credentials.","error":"PulpConnectionError: Failed to connect to Pulp at '...' with HTTP status: 401 Unauthorized"},{"fix":"Log into your Pulpcore server and confirm that the `pulp_deb` plugin is installed, enabled, and its API endpoints are available. Consult the Pulp documentation for proper plugin installation and troubleshooting.","cause":"The `pulp_deb` content plugin is likely not installed, not enabled, or not properly configured on your Pulpcore server instance.","error":"pulp_glue_core.connection.PulpConnectionError: Received 404 Not Found when trying to access /pulp/api/v3/deb/"},{"fix":"Upgrade `pulp-glue-deb` to the latest stable version using `pip install --upgrade pulp-glue-deb`. Review the `pulp-glue-deb` documentation or source code for the correct method signatures for your desired operation.","cause":"This error typically indicates that the `pulp-glue-deb` library version is significantly outdated compared to the Pulpcore server's API, or you are attempting to call a function that does not exist in the current API schema.","error":"AttributeError: 'DebClient' object has no attribute 'create_repository'"}]}