.. versionadded:: 0.17.0

    Instruct alternatives to use the highest priority
    path for <name>

    name
        is the master name for this link group
        (e.g. pager)

def auto(name):
    '''
    .. versionadded:: 0.17.0

    Instruct alternatives to use the highest priority
    path for <name>

    name
        is the master name for this link group
        (e.g. pager)

    '''
    ret = {'name': name,
           'result': True,
           'comment': '',
           'changes': {}}

    display = __salt__['alternatives.display'](name)
    line = display.splitlines()[0]
    if line.endswith(' auto mode'):
        ret['comment'] = '{0} already in auto mode'.format(name)
        return ret

    if __opts__['test']:
        ret['comment'] = '{0} will be put in auto mode'.format(name)
        ret['result'] = None
        return ret
    ret['changes']['result'] = __salt__['alternatives.auto'](name)
    return ret