libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vd...@apache.org
Subject [12/23] libcloud git commit: Fix _to_port to make it work with old versions
Date Tue, 04 Dec 2018 08:54:27 GMT
Fix _to_port to make it work with old versions


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/d34b3f07
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/d34b3f07
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/d34b3f07

Branch: refs/heads/trunk
Commit: d34b3f0734befd1dfd8b7c044af5cf911bcd69b9
Parents: 84aa986
Author: micafer <micafer1@upv.es>
Authored: Tue Sep 25 16:24:14 2018 +0200
Committer: Rick van de Loo <rickvandeloo@gmail.com>
Committed: Tue Dec 4 09:45:48 2018 +0100

----------------------------------------------------------------------
 libcloud/compute/drivers/openstack.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/d34b3f07/libcloud/compute/drivers/openstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/openstack.py b/libcloud/compute/drivers/openstack.py
index fb92dab..ebcefc2 100644
--- a/libcloud/compute/drivers/openstack.py
+++ b/libcloud/compute/drivers/openstack.py
@@ -2692,11 +2692,12 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver):
                 mac_address=element['mac_address'],
                 name=element['name'],
                 network_id=element['network_id'],
-                project_id=element['project_id'],
-                port_security_enabled=element['port_security_enabled'],
-                revision_number=element['revision_number'],
+                project_id=element.get('project_id', None),
+                port_security_enabled=element.get('port_security_enabled',
+                                                  None),
+                revision_number=element.get('revision_number', None),
                 security_groups=element['security_groups'],
-                tags=element['tags'],
+                tags=element.get('tags', None),
                 tenant_id=element['tenant_id'],
                 updated=updated,
             )
@@ -3402,8 +3403,9 @@ class OpenStack_2_FloatingIpPool(OpenStack_1_1_FloatingIpPool):
     def _to_floating_ip(self, obj):
         instance_id = None
 
+        print(obj)
         # In neutron version prior to 13.0.0 port_details does not exists
-        if 'port_details' not in obj and 'port_id' in obj:
+        if 'port_details' not in obj and 'port_id' in obj and obj['port_id']:
             port = self.connection.driver.ex_get_port(obj['port_id'])
             if port:
                 obj['port_details'] = {"device_id": port.extra["device_id"],


Mime
View raw message