From 21854e5e2fc6723f89c4ef539046abfd062b6ea8 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Mon, 7 Oct 2024 09:07:57 -0500 Subject: [PATCH] Fix backwards compatibility with list_list_flavors --- chi/server.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/chi/server.py b/chi/server.py index eaf28c7..2915b05 100644 --- a/chi/server.py +++ b/chi/server.py @@ -595,9 +595,11 @@ def list_flavors() -> List[Flavor]: Returns: A list of all flavors. """ - nova_client = nova() - flavors = nova_client.flavors.list() - return [Flavor(name=f.name, disk=f.disk, ram=f.ram, vcpus=f.vcpus) for f in flavors] + if Version(context.version) >= Version("1.0"): + nova_client = nova() + flavors = nova_client.flavors.list() + return [Flavor(name=f.name, disk=f.disk, ram=f.ram, vcpus=f.vcpus) for f in flavors] + return nova().flavors.list() def get_flavor(ref) -> NovaFlavor: