Display master link for the alternative

    .. versionadded:: 2015.8.13,2016.3.4,2016.11.0

    CLI Example:

    .. code-block:: bash

        salt '*' alternatives.show_link editor

def show_link(name):
    '''
    Display master link for the alternative

    .. versionadded:: 2015.8.13,2016.3.4,2016.11.0

    CLI Example:

    .. code-block:: bash

        salt '*' alternatives.show_link editor
    '''

    if __grains__['os_family'] == 'RedHat':
        path = '/var/lib/'
    elif __grains__['os_family'] == 'Suse':
        path = '/var/lib/rpm/'
    else:
        path = '/var/lib/dpkg/'

    path += 'alternatives/{0}'.format(name)

    try:
        with salt.utils.files.fopen(path, 'rb') as r_file:
            contents = salt.utils.stringutils.to_unicode(r_file.read())
            return contents.splitlines(True)[1].rstrip('\n')
    except OSError:
        log.error('alternatives: %s does not exist', name)
    except (IOError, IndexError) as exc:
        log.error(
            'alternatives: unable to get master link for %s. '
            'Exception: %s', name, exc
        )

    return False