Add a umount function

Does the opposite of mount. Fancy that :)
This commit is contained in:
Evan Borgstrom 2012-08-16 16:29:32 -04:00
parent 5f89a958ba
commit 08a5496b1e

View File

@ -256,6 +256,24 @@ def remount(name, device, mkmnt=False, fstype='', opts='defaults'):
return mount(name, device, mkmnt, fstype, opts)
def umount(name):
'''
Attempt to unmount a device by specifying the directory it is mounted on
CLI Example::
salt '*' mount.umount /mnt/foo
'''
mnts = active()
if name not in mnts:
return "{0} does not have anything mounted".format(name)
cmd = 'umount {0}'.format(name)
out = __salt__['cmd.run_all'](cmd)
if out['retcode']:
return out['stderr']
return True
def is_fuse_exec(cmd):
'''
Returns true if the command passed is a fuse mountable application.