Replace glanceclient with openstacksdk
The glance client will be deprecated one day. Projects using it should switch to using the OpenStack SDK instead. Also add "attrs" to requirements.txt. It was previously pulled through python-glanceclient. Change-Id: I35c598d318348c2b14323ea29c8347312733f8bc Signed-off-by: Cyril Roelandt <cyril@redhat.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
attrs # MIT
|
||||
pbr>=5.8.0 # Apache-2.0
|
||||
fastapi>=0.111.0 # MIT
|
||||
pydantic>=2.11.7,<3.0.0 # MIT
|
||||
@@ -22,7 +23,6 @@ MarkupSafe>=2.0.1 # BSD License (3 clause)
|
||||
python-multipart>=0.0.5 # Apache-2.0
|
||||
python-keystoneclient>=3.21.0 # Apache-2.0
|
||||
python-cinderclient>=8.1.0 # Apache-2.0
|
||||
python-glanceclient>=2.17.1 # Apache-2.0
|
||||
python-neutronclient>=6.14.1 # Apache-2.0
|
||||
python-novaclient>=15.1.1 # Apache-2.0
|
||||
keystoneauth1>=3.17.4 # Apache-2.0
|
||||
|
||||
@@ -35,12 +35,12 @@ def list_images(
|
||||
kwargs = {}
|
||||
if filters:
|
||||
kwargs["filters"] = filters
|
||||
gc = utils.glance_client(
|
||||
ic = utils.image_client(
|
||||
session=session,
|
||||
region=profile.region,
|
||||
global_request_id=global_request_id,
|
||||
)
|
||||
return gc.images.list(**kwargs)
|
||||
return ic.images.images(**kwargs)
|
||||
except Unauthorized as e:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
|
||||
@@ -16,8 +16,8 @@ from __future__ import annotations
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
import openstack
|
||||
from cinderclient.client import Client as CinderClient
|
||||
from glanceclient.client import Client as GlanceClient
|
||||
from keystoneauth1.access.access import AccessInfoV3
|
||||
from keystoneauth1.identity.v3 import Password, Token
|
||||
from keystoneauth1.session import Session
|
||||
@@ -114,15 +114,13 @@ def keystone_client(
|
||||
return client
|
||||
|
||||
|
||||
def glance_client(
|
||||
def image_client(
|
||||
session: Session,
|
||||
region: str,
|
||||
global_request_id: Optional[str] = None,
|
||||
version: str = constants.GLANCE_API_VERSION,
|
||||
) -> HTTPClient:
|
||||
endpoint = get_endpoint(region, "image", session=session)
|
||||
client = GlanceClient(
|
||||
version=version,
|
||||
client = openstack.connection.Connection(
|
||||
session=session,
|
||||
endpoint=endpoint,
|
||||
global_request_id=global_request_id,
|
||||
|
||||
@@ -18,7 +18,6 @@ ALGORITHM = "HS256"
|
||||
|
||||
KEYSTONE_API_VERSION = "3.13"
|
||||
NOVA_API_VERSION = "2.79"
|
||||
GLANCE_API_VERSION = "2"
|
||||
CINDER_API_VERSION = "3.59"
|
||||
NEUTRON_API_VERSION = "2.0"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user