Sort flavors with operator.itemgetter('ram')

The current syntax is not python3 compatible, so we look to shade to
help accomplish our sorting syntax.

Change-Id: Iadb39f976840fd2af6e0bd7b08bd3b01169e37a1
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-05-11 09:53:48 -04:00
parent 4a611a53ce
commit 71ff1a9bc5
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
1 changed files with 2 additions and 1 deletions

View File

@ -18,6 +18,7 @@
import logging
from contextlib import contextmanager
import operator
import shade
@ -129,7 +130,7 @@ class ProviderManager(object):
def _getFlavors(self):
flavors = self.listFlavors()
flavors.sort(lambda a, b: cmp(a['ram'], b['ram']))
flavors.sort(key=operator.itemgetter('ram'))
return flavors
# TODO(mordred): These next three methods duplicate logic that is in