summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Young <sleepsonthefloor@gmail.com>2011-08-24 12:17:58 -0700
committerAnthony Young <sleepsonthefloor@gmail.com>2011-08-24 12:17:58 -0700
commit0571c86d18c242f46e44e380b257cfc40598d31b (patch)
treed6b6b28ca215a1aaf8441fd354a5c09a549c4efc
parente2e32589c247bfa790f4459a51742cc335581d0c (diff)
use dict.get for user_id, project_id, and display_description in servers view as suggested by ed leaf, so that not all tests require these fields
-rw-r--r--nova/api/openstack/views/servers.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/nova/api/openstack/views/servers.py b/nova/api/openstack/views/servers.py
index fd7c040d4..6fd09aae6 100644
--- a/nova/api/openstack/views/servers.py
+++ b/nova/api/openstack/views/servers.py
@@ -65,9 +65,9 @@ class ViewBuilder(object):
inst_dict = {
'id': inst['id'],
'name': inst['display_name'],
- 'user_id': inst['user_id'],
- 'tenant_id': inst['project_id'],
- 'description': inst['display_description'],
+ 'user_id': inst.get('user_id', ''),
+ 'tenant_id': inst.get('project_id', ''),
+ 'description': inst.get('display_description', ''),
'status': common.status_from_power_state(inst.get('state'))}
ctxt = nova.context.get_admin_context()