Restart the traffic_manager and traffic_server processes on the local 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

        restart_ats_local:
          trafficserver.restart_local

        restart_ats_local_drain:
          trafficserver.restart_local
            - drain: True

def restart_local(name, drain=False):
    '''
    Restart the traffic_manager and traffic_server processes on the local 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

        restart_ats_local:
          trafficserver.restart_local

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

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

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