Skip to content

Commit 784358a

Browse files
committed
Fixed #131 -- better error handling in deis open
1 parent df4d7bf commit 784358a

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

client/deis.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,10 +1299,14 @@ def open(self, args):
12991299
"/api/formations/{}/calculate".format(formation))
13001300
if response.status_code == requests.codes.ok: # @UndefinedVariable
13011301
databag = json.loads(response.content)
1302-
proxy = random.choice(databag['nodes'].get('proxy', {}).values())
1303-
# use the OS's default handler to open this URL
1304-
webbrowser.open('http://{}/'.format(proxy))
1305-
return proxy
1302+
proxies = databag['nodes'].get('proxy', {}).values()
1303+
if proxies:
1304+
proxy = random.choice(proxies)
1305+
# use the OS's default handler to open this URL
1306+
webbrowser.open('http://{}/'.format(proxy))
1307+
return proxy
1308+
else:
1309+
print('No proxies found. Use `deis layers:scale proxy=1` to scale up.')
13061310
else:
13071311
print('Error!', response.text)
13081312

0 commit comments

Comments
 (0)