Adding image_list (and updating flavor_list)

This commit is contained in:
Joseph Hall 2012-11-05 15:17:37 -07:00
parent 3dd91b4127
commit 28f04d1ca1

View File

@ -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