@@ -576,20 +576,18 @@ def apps_open(self, args):
576576 app = args .get ('--app' )
577577 if not app :
578578 app = self ._session .app
579- # TODO: replace with a proxy lookup that doesn't have any side effects
580- # this currently recalculates and updates the databag
581- response = self ._dispatch ('post' ,
582- "/api/apps/{}/calculate" .format (app ))
579+ # TODO: replace with a single API call to apps endpoint
580+ response = self ._dispatch ('get' , "/api/apps/{}" .format (app ))
583581 if response .status_code == requests .codes .ok : # @UndefinedVariable
584- databag = json . loads ( response .content )
585- domains = databag . get ( 'domains' , [])
586- if domains :
587- domain = random . choice ( domains )
588- # use the OS's default handler to open this URL
589- webbrowser . open ( 'http://{}/' . format ( domain ))
590- return domain
591- else :
592- print ( 'No proxies found. Use `deis nodes:scale myformation proxy=1` to scale up.' )
582+ cluster = response .json ()[ 'cluster' ]
583+ else :
584+ raise ResponseError ( response )
585+ response = self . _dispatch ( 'get' , "/api/clusters/{}" . format ( cluster ) )
586+ if response . status_code == requests . codes . ok : # @UndefinedVariable
587+ domain = response . json ()[ ' domain' ]
588+ # use the OS's default handler to open this URL
589+ webbrowser . open ( 'http://{}.{}/' . format ( app , domain ))
590+ return domain
593591 else :
594592 raise ResponseError (response )
595593
0 commit comments