Merge pull request #18978 from garethgreenaway/nfs_requires_remount_options_changed

fixes to mount for nfs share
This commit is contained in:
Thomas S Hatch 2014-12-15 12:24:50 -07:00
commit c2a50ec4d3

View File

@ -32,6 +32,7 @@ import re
# Import salt libs
from salt._compat import string_types
from salt.exceptions import SaltInvocationError
def mounted(name,
@ -154,6 +155,18 @@ def mounted(name,
ret['result'] = None
ret['comment'] = "Remount would be forced because options changed"
return ret
else:
# nfs requires umounting and mounting if options change
# add others to list that require similiar functionality
if fstype in ['nfs']:
ret['changes']['umount'] = "Forced unmount and mount because " \
+ "options changed"
unmount_result = __salt__['mount.umount'](real_name)
if unmount_result is True:
mount_result = __salt__['mount.mount'](real_name, device, mkmnt=mkmnt, fstype=fstype, opts=opts)
ret['result'] = mount_result
else:
raise SaltInvocationError('Unable to unmount {0}: {1}.'.format(real_name, unmount_result))
else:
ret['changes']['umount'] = "Forced remount because " \
+ "options changed"