diff --git a/salt/modules/nova.py b/salt/modules/nova.py index e81e5426c3..92cd98a769 100644 --- a/salt/modules/nova.py +++ b/salt/modules/nova.py @@ -38,9 +38,9 @@ def flavor_list(): nt = _auth() ret = {} for flavor in nt.flavors.list(): - links = [] + links = {} for link in flavor.links: - links.append(link['href']) + links[link['rel']] = link['href'] ret[flavor.name] = { 'disk': flavor.disk, 'id': flavor.id, @@ -143,6 +143,29 @@ def keypair_delete(name): return 'Keypair deleted: {0}'.format(name) +def image_list(): + ''' + Return a list of available images (nova images-list) + + CLI Example:: + + salt '*' nova.image_list + ''' + nt = _auth() + ret = {} + for image in nt.images.list(): + links = {} + for link in image.links: + links[link['rel']] = link['href'] + ret[image.name] = { + 'name': image.name, + 'id': image.id, + 'status': image.status, + 'progress': image.progress, + 'links': links, + } + return ret + def _item_list(): ''' Template for writing list functions