This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 803c556b6e8ca1f5799c7bf1e311d42ae12ed5c5
Author: Tomaz Muraus <[email protected]>
AuthorDate: Sun May 3 21:13:16 2020 +0200

    Don't explode if extra dictionary doens't contain regions key.
---
 libcloud/compute/drivers/digitalocean.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libcloud/compute/drivers/digitalocean.py 
b/libcloud/compute/drivers/digitalocean.py
index 9bdedb1..2f2e0e0 100644
--- a/libcloud/compute/drivers/digitalocean.py
+++ b/libcloud/compute/drivers/digitalocean.py
@@ -137,7 +137,8 @@ class DigitalOcean_v2_NodeDriver(DigitalOcean_v2_BaseDriver,
         data = self._paginated_request('/v2/sizes', 'sizes')
         sizes = list(map(self._to_size, data))
         if location:
-            sizes = [x for x in sizes if location.id in x.extra['regions']]
+            sizes = [size for size in sizes if location.id in
+                     size.extra.get('regions', [])]
         return sizes
 
     def list_volumes(self):

Reply via email to