#NEWLINE# def get_section_attribute( args , cluster , jobs , parsing_service , current_job , host_id , instance_id , val ) : #NEWLINE# #INDENT# reg_expr = SECTION_ATTRIBUTE_REGEX . match ( val ) #NEWLINE# section = reg_expr . group ( 'section' ) #NEWLINE# attribute = reg_expr . group ( 'attribute' ) #NEWLINE# if ( section == 'cluster' ) : #NEWLINE# #INDENT# return getattr ( cluster , attribute ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# section_instance_id = instance_id #NEWLINE# if ( attribute == 'base_port' ) : #NEWLINE# #INDENT# return get_base_port ( jobs [ section ] . base_port , section_instance_id ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( current_job == section ) : #NEWLINE# #INDENT# host = jobs [ section ] . hosts [ host_id ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# host = jobs [ section ] . hosts [ 0 ] #NEWLINE# #UNINDENT# if ( host . instance_num == 1 ) : #NEWLINE# #INDENT# section_instance_id = ( - 1 ) #NEWLINE# #UNINDENT# return get_specific_dir ( host . ip , parsing_service , cluster . name , section , section_instance_id , attribute )