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 dc1ee885fe317996f88844787ef26565afce091f Author: Robert Hendriks <[email protected]> AuthorDate: Sat May 2 23:11:17 2020 +0200 Fixes #1455, added location filtering for digitalOcean driver --- libcloud/compute/drivers/digitalocean.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libcloud/compute/drivers/digitalocean.py b/libcloud/compute/drivers/digitalocean.py index c01572e..9bdedb1 100644 --- a/libcloud/compute/drivers/digitalocean.py +++ b/libcloud/compute/drivers/digitalocean.py @@ -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')
