def check_chain(table='filter', chain=None, family='ipv4'):
    '''
    .. versionadded:: 2014.1.0

    Check for the existence of a chain in the table

    CLI Example:

    .. code-block:: bash

        salt '*' iptables.check_chain filter INPUT

        IPv6:
        salt '*' iptables.check_chain filter INPUT family=ipv6
    '''

    if not chain:
        return 'Error: Chain needs to be specified'

    cmd = '{0}-save -t {1}'.format(_iptables_cmd(family), table)
    out = __salt__['cmd.run'](cmd).find(':{0} '.format(chain))

    if out != -1:
        out = True
    else:
        out = False

    return out
def check_chain ( table = 'filter' , chain = None , family = 'ipv4' ) : if not chain : return 'Error: Chain needs to be specified' cmd = '{0}-save -t {1}' . format ( _iptables_cmd ( family ) , table ) out = __salt__ [ 'cmd.run' ] ( cmd ) . find ( ':{0} ' . format ( chain ) ) if out != - 1 : out = True else : out = False return out
.. versionadded:: 2014.1.0

    Check for the existence of a chain in the table

    CLI Example:

    .. code-block:: bash

        salt '*' iptables.check_chain filter INPUT

        IPv6:
        salt '*' iptables.check_chain filter INPUT family=ipv6