From 479254f368ecfb78bf6913dc26230e378999436e Mon Sep 17 00:00:00 2001 From: Andrew Laski Date: Fri, 15 Feb 2013 15:20:23 -0500 Subject: Fix key check in instance actions formatter. The 'key in object' check doesn't work for sqlalchemy models so nothing was getting copied over during the format. This patch switches to using get() to retrieve a value. Bug 1126593 Change-Id: I726c2a624928247de41a077c23fe80742cbf9044 --- nova/api/openstack/compute/contrib/instance_actions.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/instance_actions.py b/nova/api/openstack/compute/contrib/instance_actions.py index 4ab32ad4c..ecacde7bf 100644 --- a/nova/api/openstack/compute/contrib/instance_actions.py +++ b/nova/api/openstack/compute/contrib/instance_actions.py @@ -71,15 +71,13 @@ class InstanceActionsController(wsgi.Controller): def _format_action(self, action_raw): action = {} for key in ACTION_KEYS: - if key in action_raw: - action[key] = action_raw[key] + action[key] = action_raw.get(key) return action def _format_event(self, event_raw): event = {} for key in EVENT_KEYS: - if key in event_raw: - event[key] = event_raw[key] + event[key] = event_raw.get(key) return event @wsgi.serializers(xml=InstanceActionsTemplate) -- cgit