#NEWLINE# def delete_group( self , context , group_name = None , group_id = None , delete_default = False ) : #NEWLINE# #INDENT# neutron = clients . neutron ( context ) #NEWLINE# if ( ( group_id is None ) or ( not group_id . startswith ( 'sg-' ) ) ) : #NEWLINE# #INDENT# return SecurityGroupEngineNova ( ) . delete_group ( context , group_name , group_id ) #NEWLINE# #UNINDENT# security_group = ec2utils . get_db_item ( context , group_id ) #NEWLINE# try : #NEWLINE# #INDENT# if ( not delete_default ) : #NEWLINE# #INDENT# os_security_group = neutron . show_security_group ( security_group [ 'os_id' ] ) #NEWLINE# if ( os_security_group and ( os_security_group [ 'security_group' ] [ 'name' ] == delete_default [ 'vpc_id' ] ) ) : #NEWLINE# #INDENT# raise exception . CannotDelete ( ) #NEWLINE# #UNINDENT# #UNINDENT# neutron . delete_security_group ( security_group [ 'os_id' ] ) #NEWLINE# #UNINDENT# except neutron_exception . Conflict as ex : #NEWLINE# #INDENT# raise exception . DependencyViolation ( obj1_id = group_id , obj2_id = ex . message ) #NEWLINE# #UNINDENT# except neutron_exception . NeutronClientException as ex : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# db_api . delete_item ( context , group_id )