Skip to content

Commit

Permalink
Fix backwards compatibility with list_list_flavors
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Powers committed Oct 7, 2024
1 parent 16b6624 commit 21854e5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions chi/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 21854e5

Please sign in to comment.