#NEWLINE# @ log . log_method_call #NEWLINE# def create_external_segment( self , context , external_segment ) : #NEWLINE# #INDENT# session = context . session #NEWLINE# with session . begin ( subtransactions = True ) : #NEWLINE# #INDENT# result = super ( GroupPolicyPlugin , self ) . create_external_segment ( context , external_segment ) #NEWLINE# self . extension_manager . process_create_external_segment ( session , session , result ) #NEWLINE# self . _validate_shared_create ( self , context , result , 'external_segment' ) #NEWLINE# policy_context = p_context . ExternalSegmentContext ( self , context , result ) #NEWLINE# self . policy_driver_manager . create_external_segment_precommit ( policy_context ) #NEWLINE# self . _validate_routes ( context , result ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# self . policy_driver_manager . create_external_segment_postcommit ( policy_context ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# with excutils . save_and_reraise_exception ( ) : #NEWLINE# #INDENT# LOG . exception ( _LE ( 'create_external_segment_postcommit failed, deleting external_segment %s' ) , result [ 'id' ] ) #NEWLINE# self . delete_external_segment ( context , result [ 'id' ] ) #NEWLINE# #UNINDENT# #UNINDENT# return result