@@ -437,8 +437,22 @@ def list(self, *args, **kwargs):
437437 pagination = {'results' : data , 'count' : len (data )}
438438 return Response (pagination , status = status .HTTP_200_OK )
439439
440- def restart (self , * args , ** kwargs ):
441- restart_app .delay (self .get_app (), ** kwargs )
440+ def restart (self , request , * args , ** kwargs ):
441+ app = self .get_app ()
442+ ptypes = []
443+ types = request .data .get ("types" , "" ).split ("," )
444+ types = [ptype for ptype in set (types ) if ptype != "" ]
445+ if not types :
446+ # all ptypes need to restart
447+ ptypes = app .structure .keys ()
448+ else :
449+ ptypes = [ptype for ptype in types if ptype in app .structure ]
450+ invalid_ptypes = set (types ) - set (ptypes )
451+ if len (invalid_ptypes ) != 0 :
452+ raise DryccException ("process type {} is not included in procfile" .
453+ format (',' .join (invalid_ptypes )))
454+ for ptype in set (ptypes ):
455+ restart_app .delay (self .get_app (), ** {"type" : ptype })
442456 return Response (status = status .HTTP_204_NO_CONTENT )
443457
444458 def describe (self , * args , ** kwargs ):
@@ -831,7 +845,7 @@ def path(self, request, *args, **kwargs):
831845 container_types = [_ for _ in path .keys ()
832846 if _ not in volume .app .procfile_types ]
833847 if container_types :
834- raise DryccException ("process type {} is not included in profile " .
848+ raise DryccException ("process type {} is not included in procfile " .
835849 format (',' .join (container_types )))
836850 if set (path .items ()).issubset (set (volume .path .items ())):
837851 raise DryccException ("mount path not changed" )
0 commit comments