Fixes added location filtering for digitalOcean driver
@@ -133,9 +133,12 @@ class DigitalOcean_v2_NodeDriver(DigitalOcean_v2_BaseDriver,
data = self._paginated_request('/v2/droplets', 'droplets')
return list(map(self._to_node, data))
- def list_sizes(self):
+ def list_sizes(self, location=None):
data = self._paginated_request('/v2/sizes', 'sizes')
- return list(map(self._to_size, data))
+ sizes = list(map(self._to_size, data))
+ if location:
+ sizes = [x for x in sizes if location.id in x.extra['regions']]
+ return sizes
def list_volumes(self):
data = self._paginated_request('/v2/volumes', 'volumes')
