Skip to content

Commit 58c2701

Browse files
author
Clark Perkins
committed
Fixed issue where zone ids couldn't be looked up on v0.5.*
1 parent f441801 commit 58c2701

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

stackdio/client/profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ def get_profile_id(self, slug, title=False):
5858
if profile.get("slug" if not title else "title") == slug:
5959
return profile.get("id")
6060

61-
return StackException("Profile %s not found" % slug)
61+
raise StackException("Profile %s not found" % slug)

stackdio/client/region.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,14 @@ def get_zone_id(self, title, type_name="ec2"):
6060
type_id = self.get_provider_type_id(type_name)
6161
for zone in result['results']:
6262
if zone.get("title") == title:
63-
region = self._get(zone.get("region"), jsonify=True)
64-
if region.get("provider_type") == type_id:
65-
return zone.get("id")
63+
if 'region' in zone:
64+
# For version 0.6.1
65+
region = self._get(zone['region'], jsonify=True)
66+
if region.get("provider_type") == type_id:
67+
return zone.get("id")
68+
elif 'provider_type' in zone:
69+
# For versions 0.5.*
70+
if zone['provider_type'] == type_id:
71+
return zone.get("id")
6672

6773
raise StackException("Zone %s not found for %s" % (title, type_name))

0 commit comments

Comments
 (0)