#NEWLINE# @ exception . wrap_wsme_pecan_controller_exception #NEWLINE# @ wsme_pecan . wsexpose ( pipeline . Pipeline , body = pipeline . Pipeline , status_code = 201 ) #NEWLINE# def post( self , data ) : #NEWLINE# #INDENT# 'Create a new pipeline.' #NEWLINE# js_data = data . as_dict ( objects . registry . Pipeline ) #NEWLINE# if ( data . plan_uri is not wsme . Unset ) : #NEWLINE# #INDENT# plan_uri = data . plan_uri #NEWLINE# if plan_uri . startswith ( pecan . request . host_url ) : #NEWLINE# #INDENT# pl_uuid = plan_uri . split ( '/' ) [ ( - 1 ) ] #NEWLINE# pl = objects . registry . Plan . get_by_uuid ( pecan . request . security_context , pl_uuid ) #NEWLINE# js_data [ 'plan_id' ] = pl . id #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise exception . BadRequest ( reason = _ ( 'The plan was not hosted in solum' ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( js_data . get ( 'plan_id' ) is None ) : #NEWLINE# #INDENT# raise exception . BadRequest ( reason = _ ( 'The plan was not given or could not be found' ) ) #NEWLINE# #UNINDENT# handler = pipeline_handler . PipelineHandler ( pecan . request . security_context ) #NEWLINE# return pipeline . Pipeline . from_db_model ( handler . create ( js_data ) , pecan . request . host_url )