#NEWLINE# def run( self ) : #NEWLINE# #INDENT# '\n        Run the plugin.\n        ' #NEWLINE# if ( ( self . koji_principal and ( not self . koji_keytab ) ) or ( self . koji_keytab and ( not self . koji_principal ) ) ) : #NEWLINE# #INDENT# raise RuntimeError ( 'specify both koji_principal and koji_keytab or neither' ) #NEWLINE# #UNINDENT# if self . workflow . build_process_failed : #NEWLINE# #INDENT# self . log . info ( 'Not promoting failed build to koji' ) #NEWLINE# return #NEWLINE# #UNINDENT# ( koji_metadata , output_files ) = self . get_metadata ( ) #NEWLINE# try : #NEWLINE# #INDENT# session = self . login ( ) #NEWLINE# server_dir = self . get_upload_server_dir ( ) #NEWLINE# for output in output_files : #NEWLINE# #INDENT# if output . file : #NEWLINE# #INDENT# self . upload_file ( session , output , server_dir ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# for output in output_files : #NEWLINE# #INDENT# if output . file : #NEWLINE# #INDENT# output . file . close ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# build_info = session . CGImport ( koji_metadata , server_dir ) #NEWLINE# build_id = ( build_info . get ( 'id' ) if build_info else None ) #NEWLINE# self . log . debug ( 'Submitted with metadata: %s' , json . dumps ( koji_metadata , sort_keys = True , indent = 4 ) ) #NEWLINE# self . log . debug ( 'Build information: %s' , json . dumps ( build_info , sort_keys = True , indent = 4 ) ) #NEWLINE# return build_id