#NEWLINE# def flush( table = 'filter' , chain = '' , family = 'ipv4' ) : #NEWLINE# #INDENT# "\n    Flush the chain in the specified table, flush all chains in the specified\n    table if chain is not specified.\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' nftables.flush filter\n\n        salt '*' nftables.flush filter input\n\n        IPv6:\n        salt '*' nftables.flush filter input family=ipv6\n    " #NEWLINE# if ( not check_table ( table , family = family ) ) : #NEWLINE# #INDENT# return 'Error: table {0} in family {1} does not exist' . format ( table , family ) #NEWLINE# #UNINDENT# nft_family = _NFTABLES_FAMILIES [ family ] #NEWLINE# if chain : #NEWLINE# #INDENT# if ( not check_chain ( table , chain , family = family ) ) : #NEWLINE# #INDENT# return 'Error: chain {0} in table {1} in family {2} does not exist' . format ( chain , table , nft_family ) #NEWLINE# #UNINDENT# cmd = '{0} flush chain {1} {2} {3}' . format ( _nftables_cmd ( ) , nft_family , table , chain ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cmd = '{0} flush table {1} {2}' . format ( _nftables_cmd ( ) , nft_family , table ) #NEWLINE# #UNINDENT# out = __salt__ [ 'cmd.run' ] ( cmd , python_shell = False ) #NEWLINE# if ( len ( out ) == 0 ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return False