def show_link(name):
 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.fopen(path, 'rb') as r_file:
   return r_file.readlines()[1].rstrip('\n')
 except OSError:
  log.error('alternatives: {0} does not exist'.format(name))
 except (IOError, IndexError) as exc:
  log.error('alternatives: unable to get master link for {0}. Exception: {1}'.format(name, exc))
 return False

def show_link ( name ) : 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 . fopen ( path , 'rb' ) as r_file : return r_file . readlines ( ) [ 1 ] . rstrip ( '\n' ) except OSError : log . error ( 'alternatives: {0} does not exist' . format ( name ) ) except ( IOError , IndexError ) as exc : log . error ( 'alternatives: unable to get master link for {0}. Exception: {1}' . format ( name , exc ) ) return False
display master link for the alternative .