#NEWLINE# def create_plan( client , plan_file ) : #NEWLINE# #INDENT# cmd = [ 'solum' , 'app' , 'create' , plan_file ] #NEWLINE# print ( ' ' . join ( cmd ) ) #NEWLINE# with open ( plan_file ) as definition_file : #NEWLINE# #INDENT# definition = definition_file . read ( ) #NEWLINE# #UNINDENT# plan = client . plans . create ( definition ) #NEWLINE# fields = [ 'uuid' , 'name' , 'description' , 'uri' ] #NEWLINE# data = dict ( [ ( f , getattr ( plan , f , '' ) ) for f in fields ] ) #NEWLINE# cliutils . print_dict ( data , wrap = 72 ) #NEWLINE# if ( data [ 'uri' ] is None ) : #NEWLINE# #INDENT# print ( 'Error: no uri found in plan creation' ) #NEWLINE# exit ( 1 ) #NEWLINE# #UNINDENT# artifacts = getattr ( plan , 'artifacts' , [ ] ) #NEWLINE# for arti in artifacts : #NEWLINE# #INDENT# content = getattr ( arti , 'content' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# if ( ( 'public_key' in content ) and ( 'href' in content ) ) : #NEWLINE# #INDENT# CREDENTIALS [ content [ 'href' ] ] [ 'pub_key' ] = content [ 'public_key' ] #NEWLINE# #UNINDENT# #UNINDENT# return data [ 'uri' ]