Bounce Traffic Server on the local node. Bouncing Traffic Server shuts down
    and immediately restarts the Traffic Server node.

    This option modifies the behavior of traffic_line -b and traffic_line -L
    such that traffic_server is not shut down until the number of active client
    connections drops to the number given by the
    proxy.config.restart.active_client_threshold configuration variable.

    .. code-block:: yaml

        bounce_ats_local:
          trafficserver.bounce_local

        bounce_ats_local:
          trafficserver.bounce_local
            - drain: True

def bounce_local(name, drain=False):
    '''
    Bounce Traffic Server on the local node. Bouncing Traffic Server shuts down
    and immediately restarts the Traffic Server node.

    This option modifies the behavior of traffic_line -b and traffic_line -L
    such that traffic_server is not shut down until the number of active client
    connections drops to the number given by the
    proxy.config.restart.active_client_threshold configuration variable.

    .. code-block:: yaml

        bounce_ats_local:
          trafficserver.bounce_local

        bounce_ats_local:
          trafficserver.bounce_local
            - drain: True
    '''
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    if __opts__['test']:
        ret['comment'] = 'Bouncing local node'
        return ret

    if drain:
        __salt__['trafficserver.bounce_local'](drain=True)
        ret['result'] = True
        ret['comment'] = 'Bounced local node with drain option'
        return ret
    else:
        __salt__['trafficserver.bounce_local']()
        ret['result'] = True
        ret['comment'] = 'Bounced local node'
        return ret