DigitalOcean: typecast map function for Python3 (#37168)

In Python2, `map` returns list whereas Python3, `map` function
 returns iterator. This fix typecast map function for Python3.

Fixes: #37114

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 8f3f7f104f)
pull/37228/head
Abhijeet Kasurde 7 years ago committed by Matt Davis
parent e02b237649
commit 1842e34a73

@ -307,7 +307,7 @@ class Droplet(JsonfyMixIn):
@classmethod @classmethod
def list_all(cls): def list_all(cls):
json = cls.manager.all_active_droplets() json = cls.manager.all_active_droplets()
return map(cls, json) return [cls(j) for j in json]
class SSH(JsonfyMixIn): class SSH(JsonfyMixIn):
@ -338,7 +338,7 @@ class SSH(JsonfyMixIn):
@classmethod @classmethod
def list_all(cls): def list_all(cls):
json = cls.manager.all_ssh_keys() json = cls.manager.all_ssh_keys()
return map(cls, json) return [cls(j) for j in json]
@classmethod @classmethod
def add(cls, name, key_pub): def add(cls, name, key_pub):

Loading…
Cancel
Save