def insert(table='filter', chain=None, position=None, rule=None, family='ipv4'):
    if not chain:
        return 'Error: Chain needs to be specified'
    if not rule:
        return 'Error: Rule needs to be specified'

    if not check_table(table, family=family):
        return 'Error: table {0} in family {1} does not exist'.\
                format(table, family)

    if not check_chain(table, chain, family=family):
        return 'Error: chain {0} in table {1} in family {2} does not exist'.\
                format(chain, table, family)

    if check(table, chain, rule, family=family):
        return 'Error: rule {0} chain {1} in table {2} in family {3} already exists'.\
                format(rule, chain, table, family)

    nft_family = _NFTABLES_FAMILIES[family]
    if position:
        cmd = '{0} insert rule {1} {2} {3} position {4} {5}'.\
                format(_nftables_cmd(), nft_family, table, chain, position, rule)
    else:
        cmd = '{0} insert rule {1} {2} {3} {4}'.\
                format(_nftables_cmd(), nft_family, table, chain, rule)
    out = __salt__['cmd.run'](cmd, python_shell=False)

    if len(out) == 0:
        return True
    else:
        return False
Used to log when a state is exited.
dataset/ETHPy150Open saltstack/salt/salt/modules/nftables.py/insert--crossover with--dataset/ETHPy150Open openstack/ironic/ironic/common/states.py/on_exit