python-zunclient

raw JSON →
5.4.0 verified Fri May 01 auth: no python maintenance

Client library for OpenStack Zun (Container Management service). Version 5.4.0. This is a legacy OpenStack client, mainly in maintenance mode.

pip install python-zunclient
error AttributeError: module 'zunclient' has no attribute 'client'
cause Importing incorrectly; the correct module is `zunclient.client`.
fix
Use from zunclient import client (do not use import zunclient then zunclient.client).
error zunclient.exceptions.EndpointNotFound
cause No Zun service endpoint found in Keystone catalog. The service may not be enabled, or the auth URL is wrong.
fix
Verify OpenStack services are running and the service catalog contains a 'container' endpoint. Ensure env vars OS_AUTH_URL, OS_USERNAME, etc. are correct.
gotcha The library supports multiple API versions (1, 2). Version 2 is microversion-based. Using the wrong API version may cause unexpected AttributeErrors.
fix Specify the correct API version when creating the client: `client.Client(2, ...)` or `client.Client(1, ...)`.
deprecated OpenStack Zun and its client library are in maintenance mode. No new features are added; only critical bug fixes. Consider using the OpenStack SDK (openstacksdk) for a more modern and unified API.
fix Migrate to `openstacksdk` using `import openstack` and `conn = openstack.connect()`.

Initialize Zun client and list containers.

import os
from zunclient import client

# Create client using Keystone auth
auth_url = os.environ.get('OS_AUTH_URL', 'http://localhost:5000/v3')
project_name = os.environ.get('OS_PROJECT_NAME', 'admin')
username = os.environ.get('OS_USERNAME', 'admin')
password = os.environ.get('OS_PASSWORD', 'admin')
user_domain_name = os.environ.get('OS_USER_DOMAIN_NAME', 'Default')
project_domain_name = os.environ.get('OS_PROJECT_DOMAIN_NAME', 'Default')

kclient = client.Client(1, auth_url=auth_url,
                        username=username,
                        password=password,
                        project_name=project_name,
                        user_domain_name=user_domain_name,
                        project_domain_name=project_domain_name)
print('Containers:', list(kclient.containers.list()))