{"id":9257,"library":"python-ironicclient","title":"OpenStack Ironic Client Library","description":"python-ironicclient is the official Python client library for the OpenStack Ironic API, which provides bare metal provisioning services. It offers a Python API for programmatic interaction and integrates with the `openstack baremetal` command-line interface. The current stable version is 6.0.0, actively maintained within the OpenStack project, with releases generally aligned with the OpenStack release cycle (typically every six months).","status":"active","version":"6.0.0","language":"en","source_language":"en","source_url":"https://github.com/openstack/python-ironicclient","tags":["openstack","bare-metal","cloud","provisioning","infrastructure"],"install":[{"cmd":"pip install python-ironicclient","lang":"bash","label":"Core library"},{"cmd":"pip install python-ironicclient[cli]","lang":"bash","label":"With CLI functionality"}],"dependencies":[{"reason":"Required for authentication with OpenStack Identity (Keystone).","package":"keystoneauth1"},{"reason":"Used for broader OpenStack service interaction and is a dependency for `openstackclient`.","package":"openstacksdk"},{"reason":"OpenStackClient Library, a common utility library for OpenStack clients.","package":"osc-lib"},{"reason":"Common OpenStack utility library for various functionalities.","package":"oslo.utils"},{"reason":"HTTP client library for making API requests.","package":"requests"}],"imports":[{"note":"The primary `client` object is available directly under `ironicclient`, abstracting API versioning.","wrong":"from ironicclient.v1 import client","symbol":"client","correct":"from ironicclient import client"}],"quickstart":{"code":"import os\nfrom ironicclient import client\n\n# Configure with actual Ironic API endpoint and Keystone authentication token\nIRONIC_URL = os.environ.get('IRONIC_URL', 'http://localhost:6385/')\nOS_AUTH_TOKEN = os.environ.get('OS_AUTH_TOKEN', 'YOUR_AUTH_TOKEN_HERE')\n\nif not OS_AUTH_TOKEN or 'YOUR_AUTH_TOKEN_HERE' in OS_AUTH_TOKEN:\n    print(\"Warning: OS_AUTH_TOKEN not set or is a placeholder. API calls may fail.\")\n\nkwargs = {\n    'os_auth_token': OS_AUTH_TOKEN,\n    'ironic_url': IRONIC_URL\n}\n\ntry:\n    # API version 1 is common, newer microversions can be specified if needed\n    ironic = client.get_client(1, **kwargs)\n    nodes = ironic.node.list()\n    print(f\"Successfully connected to Ironic. Found {len(nodes)} nodes.\")\n    for node in nodes:\n        print(f\" - Node UUID: {node.uuid}, Name: {node.name}\")\nexcept Exception as e:\n    print(f\"Error connecting to Ironic or listing nodes: {e}\")\n    print(\"Please ensure IRONIC_URL and OS_AUTH_TOKEN are correctly configured and Ironic API is reachable.\")","lang":"python","description":"Initializes the Ironic client using an authentication token and the Ironic API endpoint, then attempts to list all bare metal nodes. Environment variables are used for sensitive credentials."},"warnings":[{"fix":"Use `openstack baremetal <subcommand>` after installing `python-openstackclient` or `python-ironicclient[cli]`.","message":"The standalone `ironic` command-line interface (CLI) is largely superseded by the unified `openstack baremetal` commands available through `python-openstackclient`.","severity":"deprecated","affected_versions":"All versions, `openstack baremetal` is the long-standing preferred CLI."},{"fix":"Migrate to using Ironic's built-in in-band inspection capabilities instead of relying on the deprecated `ironic-inspector-client`.","message":"The `python-ironic-inspector-client` library is no longer maintained. Its functionality for hardware introspection has been integrated directly into Ironic itself.","severity":"gotcha","affected_versions":"All versions, especially for new deployments."},{"fix":"Ensure `os_auth_token` is a valid Keystone token and `ironic_url` points to the correct Ironic API endpoint (e.g., `http://<ironic-host>:6385/`).","message":"Ironic client initialization requires both `os_auth_token` and `ironic_url`. Forgetting either, or providing incorrect values, will lead to authentication or connection errors.","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 the `ironic_url` (default port is 6385) is correct and that the Ironic API service is running and accessible from where the client is executed. Check firewall rules and network routes.","cause":"The Ironic API endpoint specified in `ironic_url` is unreachable, either due to an incorrect URL/port, network configuration (firewall), or the Ironic API service not running.","error":"ironicclient.exc.HTTPClientError: Error contacting Ironic server: Connection refused"},{"fix":"Ensure the Ironic service is registered in Keystone and its endpoint is correctly configured. Verify the `region_name` if explicitly provided, or ensure the default region is correct for your OpenStack deployment.","cause":"The OpenStack service catalog, usually retrieved via Keystone, does not contain an entry for the Ironic (baremetal) service, or the specified region is incorrect.","error":"keystoneauth1.exceptions.catalog.EndpointNotFound: Could not find endpoint for service 'baremetal' in region 'RegionOne'."},{"fix":"Ensure you are initializing the client with a supported API version, e.g., `client.get_client(1, **kwargs)`. Consult Ironic API documentation for the correct microversion usage if needed.","cause":"This usually indicates an issue with the API version or an internal client error where the expected resource manager (e.g., `node`) is not available or has changed its access path.","error":"AttributeError: 'ClientManager' object has no attribute 'node'"}]}