diff options
| author | John Tran <jtran@attinteractive.com> | 2011-08-02 11:28:43 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-08-02 11:28:43 +0000 |
| commit | 83066aa64ccba34e23063eee661375b11de2161f (patch) | |
| tree | b11d32fbec90d2eb644487ba16578adedcc4551c /nova/api | |
| parent | f05628dff7aebd15e3f3530295ece3372bf2dbec (diff) | |
| parent | 094b9845500e28d315f70aa1fbc37b75c143d0c0 (diff) | |
| download | nova-83066aa64ccba34e23063eee661375b11de2161f.tar.gz nova-83066aa64ccba34e23063eee661375b11de2161f.tar.xz nova-83066aa64ccba34e23063eee661375b11de2161f.zip | |
code was checking for key in sqlalchemy instance and will ignore if value is None, but wasn't working if floating_ip was a non-sqlalchemy dict obj. Therefore, updated the error checking to work in both caes.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/contrib/floating_ips.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/nova/api/openstack/contrib/floating_ips.py b/nova/api/openstack/contrib/floating_ips.py index b4a211857..3d8049324 100644 --- a/nova/api/openstack/contrib/floating_ips.py +++ b/nova/api/openstack/contrib/floating_ips.py @@ -27,9 +27,9 @@ from nova.api.openstack import extensions def _translate_floating_ip_view(floating_ip): result = {'id': floating_ip['id'], 'ip': floating_ip['address']} - if 'fixed_ip' in floating_ip: + try: result['fixed_ip'] = floating_ip['fixed_ip']['address'] - else: + except (TypeError, KeyError): result['fixed_ip'] = None if 'instance' in floating_ip: result['instance_id'] = floating_ip['instance']['id'] |
