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).
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
The primary `client` object is available directly under `ironicclient`, abstracting API versioning.
from ironicclient import client
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.
import os
from ironicclient import client
# Configure with actual Ironic API endpoint and Keystone authentication token
IRONIC_URL = os.environ.get('IRONIC_URL', 'http://localhost:6385/')
OS_AUTH_TOKEN = os.environ.get('OS_AUTH_TOKEN', 'YOUR_AUTH_TOKEN_HERE')
if not OS_AUTH_TOKEN or 'YOUR_AUTH_TOKEN_HERE' in OS_AUTH_TOKEN:
print("Warning: OS_AUTH_TOKEN not set or is a placeholder. API calls may fail.")
kwargs = {
'os_auth_token': OS_AUTH_TOKEN,
'ironic_url': IRONIC_URL
}
try:
# API version 1 is common, newer microversions can be specified if needed
ironic = client.get_client(1, **kwargs)
nodes = ironic.node.list()
print(f"Successfully connected to Ironic. Found {len(nodes)} nodes.")
for node in nodes:
print(f" - Node UUID: {node.uuid}, Name: {node.name}")
except Exception as e:
print(f"Error connecting to Ironic or listing nodes: {e}")
print("Please ensure IRONIC_URL and OS_AUTH_TOKEN are correctly configured and Ironic API is reachable.")
openstack --version
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.
Agent activity
0 hits · last 30 days
No traffic data recorded yet.