@@ -595,26 +595,6 @@ def builds(self, args):
595595 """
596596 return self .builds_list (args )
597597
598- def builds_create (self , args ):
599- """
600- Create a new build for a formation
601-
602- Usage: deis builds:create - [--formation=<formation>]
603- """
604- formation = args .get ('--formation' )
605- if not formation :
606- formation = self ._session .formation
607- data = sys .stdin .read ()
608- # url / sha / slug_size / procfile / checksum
609- j = json .loads (data )
610- response = self ._dispatch ('post' ,
611- "/api/formations/{}/builds" .format (formation ),
612- body = json .dumps (j ))
613- if response .status_code == requests .codes .created : # @UndefinedVariable
614- print ('Build created.' )
615- else :
616- raise ResponseError (response )
617-
618598 def builds_list (self , args ):
619599 """
620600 List build history for a formation
@@ -766,7 +746,7 @@ def containers_list(self, args):
766746
767747 def containers_scale (self , args ):
768748 """
769- Scale containers for a formation
749+ Scale an application's containers by type
770750
771751 Example: deis containers:scale web=4 worker=2
772752
@@ -1276,13 +1256,13 @@ def logs(self, args):
12761256 """
12771257 Retrieve the most recent log events
12781258
1279- Usage: deis logs
1259+ Usage: deis logs [--app=<app>]
12801260 """
1281- formation = args .get ('--formation ' )
1282- if not formation :
1283- formation = self ._session .formation
1261+ app = args .get ('--app ' )
1262+ if not app :
1263+ app = self ._session .app
12841264 response = self ._dispatch ('post' ,
1285- "/api/formations /{}/logs" .format (formation ))
1265+ "/api/apps /{}/logs" .format (app ))
12861266 if response .status_code == requests .codes .ok : # @UndefinedVariable
12871267 print (response .json ())
12881268 elif response .status_code == requests .codes .not_found : # @UndefinedVariable
@@ -1389,24 +1369,39 @@ def nodes_scale(self, args):
13891369 else :
13901370 raise ResponseError (response )
13911371
1392- def providers (self , args ):
1372+ def nodes_converge (self , args ):
13931373 """
1394- Valid commands for providers:
1374+ Force converge a node
13951375
1396- providers:list list available providers for the logged in user
1397- providers:discover discover provider credentials using envvars
1398- providers:create create a new provider for use by deis
1399- providers:info print information about a specific provider
1376+ Converging a node will force a client-client run and
1377+ return its output
14001378
1401- Use ` deis help [command]` to learn more
1379+ Usage: deis nodes:converge <id>
14021380 """
1403- return self .providers_list (args )
1381+ node = args .get ('<id>' )
1382+ sys .stdout .write ('Converging {} node... ' .format (node ))
1383+ sys .stdout .flush ()
1384+ try :
1385+ progress = TextProgress ()
1386+ progress .start ()
1387+ before = time .time ()
1388+ response = self ._dispatch ('post' ,
1389+ "/api/nodes/{}/converge" .format (node ))
1390+ finally :
1391+ progress .cancel ()
1392+ progress .join ()
1393+ if response .status_code == requests .codes .ok : # @UndefinedVariable
1394+ print ('done in {}s' .format (int (time .time () - before )))
1395+ output = json .loads (response .content )
1396+ print (output )
1397+ else :
1398+ raise ResponseError (response )
14041399
1405- def ssh (self , args ):
1400+ def nodes_ssh (self , args ):
14061401 """
14071402 SSH into a node
14081403
1409- Usage: deis ssh <node> [<command>...]
1404+ Usage: deis nodes: ssh <node> [<command>...]
14101405 """
14111406 node = args .get ('<node>' )
14121407 response = self ._dispatch ('get' ,
@@ -1431,6 +1426,19 @@ def ssh(self, args):
14311426 else :
14321427 raise ResponseError (response )
14331428
1429+ def providers (self , args ):
1430+ """
1431+ Valid commands for providers:
1432+
1433+ providers:list list available providers for the logged in user
1434+ providers:discover discover provider credentials using envvars
1435+ providers:create create a new provider for use by deis
1436+ providers:info print information about a specific provider
1437+
1438+ Use `deis help [command]` to learn more
1439+ """
1440+ return self .providers_list (args )
1441+
14341442 def open (self , args ):
14351443 """
14361444 Open a URL to the application in a browser
@@ -1446,7 +1454,7 @@ def open(self, args):
14461454 "/api/apps/{}/calculate" .format (app ))
14471455 if response .status_code == requests .codes .ok : # @UndefinedVariable
14481456 databag = json .loads (response .content )
1449- proxies = databag [ 'nodes' ] .get ('proxy ' , {}). values ( )
1457+ proxies = databag .get ('proxies ' , [] )
14501458 if proxies :
14511459 proxy = random .choice (proxies )
14521460 # use the OS's default handler to open this URL
@@ -1624,6 +1632,7 @@ def parse_args(cmd):
16241632 'scale' : 'containers:scale' ,
16251633 'converge' : 'formations:converge' ,
16261634 'calculate' : 'apps:calculate' ,
1635+ 'ssh' : 'nodes:ssh' ,
16271636 }
16281637 if cmd == 'help' :
16291638 cmd = sys .argv [- 1 ]
0 commit comments