Allow alternatives.show_link function to work on Suse distros

This should fixup the failing integration.states.alternatives test
in 2016.3 as well. The alternatives.install state relies on checking
if the output of alternatives.show_link matches the path passed into
the state. Since show_link didn't work on suse correctly, the state
doesn't install the alternative and returns False.
This commit is contained in:
rallytime 2016-10-11 12:46:31 -06:00
parent bdbf1619cb
commit b8ffd9f53f

View file

@ -76,9 +76,14 @@ def show_link(name):
salt '*' alternatives.show_link editor
'''
path = '/var/lib/dpkg/alternatives/{0}'.format(name)
if _get_cmd() == 'alternatives':
path = '/var/lib/alternatives/{0}'.format(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: