Ensure iptable is not present.

    name
        The ip address or CIDR for the rule.

    method
        The type of rule.  Either 'allow' or 'deny'.

    port
        Optional port to be open or closed for the
        iptables rule.

    proto
        The protocol. Either 'tcp', 'udp'.
        Only applicable if port is specified.

    direction
        The diretion of traffic to apply the rule to.
        Either 'in', or 'out'. Only applicable if
        port is specified.

    port_origin
        Specifies either the source or destination
        port is relevant for this rule. Only applicable
        if port is specified.  Either 's', or 'd'.

    ip_origin
        Specifies whether the ip in this rule refers to
        the source or destination ip. Either 's', or
        'd'. Only applicable if port is specified.

    ttl
        How long the rule should exist. If supplied,
        `csf.tempallow()` or csf.tempdeny()` are used.

    reload
        Reload the csf service after applying this rule.
        Default false.

def rule_absent(name,
                method,
                port=None,
                proto='tcp',
                direction='in',
                port_origin='d',
                ip_origin='s',
                ttl=None,
                reload=False):
    '''
    Ensure iptable is not present.

    name
        The ip address or CIDR for the rule.

    method
        The type of rule.  Either 'allow' or 'deny'.

    port
        Optional port to be open or closed for the
        iptables rule.

    proto
        The protocol. Either 'tcp', 'udp'.
        Only applicable if port is specified.

    direction
        The diretion of traffic to apply the rule to.
        Either 'in', or 'out'. Only applicable if
        port is specified.

    port_origin
        Specifies either the source or destination
        port is relevant for this rule. Only applicable
        if port is specified.  Either 's', or 'd'.

    ip_origin
        Specifies whether the ip in this rule refers to
        the source or destination ip. Either 's', or
        'd'. Only applicable if port is specified.

    ttl
        How long the rule should exist. If supplied,
        `csf.tempallow()` or csf.tempdeny()` are used.

    reload
        Reload the csf service after applying this rule.
        Default false.
    '''
    ip = name
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': 'Rule not present.'}

    exists = __salt__['csf.exists'](method,
                                    ip,
                                    port=port,
                                    proto=proto,
                                    direction=direction,
                                    port_origin=port_origin,
                                    ip_origin=ip_origin,
                                    ttl=ttl)

    if not exists:
        return ret
    else:
        rule = __salt__['csf.remove_rule'](method=method,
                                            ip=ip,
                                            port=port,
                                            proto=proto,
                                            direction=direction,
                                            port_origin=port_origin,
                                            ip_origin=ip_origin,
                                            comment='',
                                            ttl=ttl)

        if rule:
            comment = 'Rule has been removed.'
        if reload:
            if __salt__['csf.reload']():
                comment += ' Csf reloaded.'
            else:
                comment += 'Csf unable to be reloaded.'
        ret['comment'] = comment
        ret['changes']['Rule'] = 'Removed'
    return ret