summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorTrey Morris <trey.morris@rackspace.com>2010-12-27 20:17:53 +0000
committerTrey Morris <trey.morris@rackspace.com>2010-12-27 20:17:53 +0000
commite86f765181a9d0a75486a98e827cc8505b7c4111 (patch)
treec79d1ce7859986e509385f20211c8658f819ca43 /nova/api
parent0c983d1f3cba82f992fc128985f4f794fb76190f (diff)
downloadnova-e86f765181a9d0a75486a98e827cc8505b7c4111.tar.gz
nova-e86f765181a9d0a75486a98e827cc8505b7c4111.tar.xz
nova-e86f765181a9d0a75486a98e827cc8505b7c4111.zip
inst -> item
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/images.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py
index 8a16bcb0f..77625bab5 100644
--- a/nova/api/openstack/images.py
+++ b/nova/api/openstack/images.py
@@ -30,11 +30,11 @@ from nova.api.openstack import faults
FLAGS = flags.FLAGS
-def _translate_keys(inst):
+def _translate_keys(item):
"""
Maps key names to Rackspace-like attributes for return
also pares down attributes to those we want
- inst is a single item (dict)
+ item is a dict
Note: should be removed when the set of keys expected by the api
and the set of keys returned by the image service are equivalent
@@ -46,7 +46,7 @@ def _translate_keys(inst):
'id': 'imageId',
'name': 'imageLocation'}
- mapped_inst = {}
+ mapped_item = {}
# TODO(tr3buchet):
# this chunk of code works with s3 and the local image service/glance
# when we switch to glance/local image service it can be replaced with
@@ -54,40 +54,40 @@ def _translate_keys(inst):
try:
for k, v in mapped_keys.iteritems():
# map s3 fields
- mapped_inst[k] = inst[v]
+ mapped_item[k] = item[v]
except KeyError:
# return only the fields api expects
- mapped_inst = _filter_keys(inst, mapped_keys.keys())
+ mapped_item = _filter_keys(item, mapped_keys.keys())
- return mapped_inst
+ return mapped_item
-def _translate_status(inst):
+def _translate_status(item):
"""
Translates status of image to match current Rackspace api bindings
- inst is a single item (dict)
+ item is a dict
Note: should be removed when the set of statuses expected by the api
and the set of statuses returned by the image service are equivalent
"""
- mapped_inst = {}
+ mapped_item = {}
status_mapping = {
'pending': 'queued',
'decrypting': 'preparing',
'untarring': 'saving',
'available': 'active'}
- mapped_inst['status'] = status_mapping[inst['status']]
- return mapped_inst
+ mapped_item['status'] = status_mapping[item['status']]
+ return mapped_item
-def _filter_keys(inst, keys):
+def _filter_keys(item, keys):
"""
Filters all model attributes except for keys
- inst is a single item (dict)
+ item is a dict
"""
- return dict((k, v) for k, v in inst.iteritems() if k in keys)
+ return dict((k, v) for k, v in item.iteritems() if k in keys)
class Controller(wsgi.Controller):