#NEWLINE# def create( self , data , commit_sha = '' , status_url = None ) : #NEWLINE# #INDENT# 'Create a new resource.' #NEWLINE# if ( ( 'workflow' in data ) and isinstance ( data [ 'workflow' ] , list ) ) : #NEWLINE# #INDENT# data [ 'workflow' ] = list ( set ( data [ 'workflow' ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# data [ 'workflow' ] = [ 'unittest' , 'build' , 'deploy' ] #NEWLINE# #UNINDENT# db_obj = objects . registry . Assembly ( ) #NEWLINE# db_obj . update ( data ) #NEWLINE# db_obj . uuid = str ( uuid . uuid4 ( ) ) #NEWLINE# db_obj . user_id = self . context . user #NEWLINE# db_obj . project_id = self . context . tenant #NEWLINE# db_obj . username = self . context . user_name #NEWLINE# db_obj . status = ASSEMBLY_STATES . QUEUED #NEWLINE# db_obj . create ( self . context ) #NEWLINE# plan_obj = objects . registry . Plan . get_by_id ( self . context , db_obj . plan_id ) #NEWLINE# artifacts = plan_obj . raw_content . get ( 'artifacts' , [ ] ) #NEWLINE# for arti in data : #NEWLINE# #INDENT# self . _build_artifact ( assem = db_obj , artifact = arti , commit_sha = commit_sha , status_url = status_url ) #NEWLINE# #UNINDENT# return db_obj