@@ -626,6 +626,7 @@ def flavors(self, args):
626626 Valid commands for flavors:
627627
628628 flavors:create create a new node flavor
629+ flavors:update update an existing node flavor
629630 flavors:info print information about a node flavor
630631 flavors:list list available flavors
631632 flavors:delete delete a node flavor
@@ -658,6 +659,30 @@ def flavors_create(self, args):
658659 else :
659660 print ('Error!' , response .text )
660661
662+ def flavors_update (self , args ):
663+ """
664+ Create an existing node flavor
665+
666+ Usage: deis flavors:update <id> --params=<params> [options]
667+
668+ Options:
669+
670+ --params=PARAMS provider-specific parameters (size, region, zone, etc.)
671+ --init=INIT override Ubuntu cloud-init with custom YAML
672+ """
673+ flavor = args .get ('<id>' )
674+ body = {'id' : flavor }
675+ fields = ('params' , 'init' )
676+ for fld in fields :
677+ opt = args .get ('--' + fld )
678+ if opt :
679+ body .update ({fld : opt })
680+ response = self ._dispatch ('patch' , '/api/flavors/{}' .format (flavor ), json .dumps (body ))
681+ if response .status_code == requests .codes .ok : # @UndefinedVariable
682+ print ("{0[id]}" .format (response .json ()))
683+ else :
684+ print ('Error!' , response .text )
685+
661686 def flavors_delete (self , args ):
662687 """
663688 Delete a node flavor
0 commit comments