diff options
| author | Anthony Young <sleepsonthefloor@gmail.com> | 2011-08-31 21:34:10 -0700 |
|---|---|---|
| committer | Anthony Young <sleepsonthefloor@gmail.com> | 2011-08-31 21:34:10 -0700 |
| commit | fdf076a04e001b897d01b2a8c4a9e3c980ea8f94 (patch) | |
| tree | f1b99620ee70826e4ce8acb6cbf1da3772b12316 /nova/api | |
| parent | e0e98075fc520428033e7ebd11eb68d37a4ca5c8 (diff) | |
fix for lp838583 - return instance_id for associated floating_ips, add test
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/contrib/floating_ips.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/nova/api/openstack/contrib/floating_ips.py b/nova/api/openstack/contrib/floating_ips.py index 6ce531c8f..d1add8f83 100644 --- a/nova/api/openstack/contrib/floating_ips.py +++ b/nova/api/openstack/contrib/floating_ips.py @@ -36,9 +36,9 @@ def _translate_floating_ip_view(floating_ip): result['fixed_ip'] = floating_ip['fixed_ip']['address'] except (TypeError, KeyError): result['fixed_ip'] = None - if 'instance' in floating_ip: - result['instance_id'] = floating_ip['instance']['id'] - else: + try: + result['instance_id'] = floating_ip['fixed_ip']['instance_id'] + except (TypeError, KeyError): result['instance_id'] = None return {'floating_ip': result} |
