From 08a5496b1eb23643522a38cdd5b4ff137ef1f5df Mon Sep 17 00:00:00 2001 From: Evan Borgstrom Date: Thu, 16 Aug 2012 16:29:32 -0400 Subject: [PATCH] Add a umount function Does the opposite of mount. Fancy that :) --- salt/modules/mount.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/salt/modules/mount.py b/salt/modules/mount.py index 7f971bd1ee..8b941eb994 100644 --- a/salt/modules/mount.py +++ b/salt/modules/mount.py @@ -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.