#NEWLINE# def destroy_namespace( conf , namespace , force = False ) : #NEWLINE# #INDENT# 'Destroy a given namespace.\n\n    If force is True, then dhcp (if it exists) will be disabled and all\n    devices will be forcibly removed.\n    ' #NEWLINE# try : #NEWLINE# #INDENT# ip = ip_lib . IPWrapper ( namespace = namespace ) #NEWLINE# if force : #NEWLINE# #INDENT# kill_dhcp ( conf , namespace ) #NEWLINE# if ip . netns . exists ( namespace ) : #NEWLINE# #INDENT# for device in ip . get_devices ( exclude_loopback = True ) : #NEWLINE# #INDENT# unplug_device ( ip , device ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# ip . garbage_collect_namespace ( ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# LOG . exception ( _LE ( 'Error unable to destroy namespace: %s' ) , namespace )