@@ -400,12 +400,20 @@ def containers_list(self, args):
400400 if not formation :
401401 formation = self ._session .formation
402402 response = self ._dispatch ('get' ,
403- '/formations/{}/containers' .format (formation ))
403+ '/api/formations/{}/containers' .format (formation ))
404+ databag = self .formations_calculate ({}, quiet = True )
405+ procfile = databag ['release' ]['build' ].get ('procfile' , {})
404406 if response .status_code == requests .codes .ok : # @UndefinedVariable
405- print ('=== {0}' .format (formation ))
406407 data = response .json ()
408+ c_map = {}
407409 for item in data ['results' ]:
408- print ('{0[uuid]}' .format (item ))
410+ c_map .setdefault (item ['type' ], []).append (item )
411+ for c_type in c_map .keys ():
412+ command = procfile .get (c_type , '<none>' )
413+ print ('=== {c_type}: `{command}`' .format (** locals ()))
414+ for c in c_map [c_type ]:
415+ print ('{type}.{num} up {created}' .format (** c ))
416+ print
409417 else :
410418 print ('Error!' , response .text )
411419
@@ -511,13 +519,14 @@ def formations_create(self, args):
511519 stdout = subprocess .PIPE )
512520 except subprocess .CalledProcessError :
513521 sys .exit (1 )
514- print ('Git remote deis added\n ' )
522+ print ('Git remote deis added' )
515523 # create default layers if a flavor was provided
516524 flavor = args .get ('--flavor' )
517525 if flavor :
526+ print
518527 self .layers_create ({'<id>' : 'runtime' , '<flavor>' : flavor })
519528 self .layers_create ({'<id>' : 'proxy' , '<flavor>' : flavor })
520- print ('\n Use `deis layers:scale runtime=1 proxy=1` to scale a basic formation\n ' )
529+ print ('\n Use `deis layers:scale runtime=1 proxy=1` to scale a basic formation' )
521530 else :
522531 print ('Error!' , response .text )
523532
@@ -582,7 +591,7 @@ def formations_destroy(self, args):
582591 else :
583592 print ('Error!' , response .text )
584593
585- def formations_calculate (self , args ):
594+ def formations_calculate (self , args , quiet = False ):
586595 """
587596 Usage: deis formations:calculate
588597 """
@@ -593,7 +602,9 @@ def formations_calculate(self, args):
593602 '/api/formations/{}/calculate' .format (formation ))
594603 if response .status_code == requests .codes .ok : # @UndefinedVariable
595604 databag = json .loads (response .content )
596- print (json .dumps (databag , indent = 2 ))
605+ if quiet is False :
606+ print (json .dumps (databag , indent = 2 ))
607+ return databag
597608 else :
598609 print ('Error!' , response .text )
599610
0 commit comments