Byron Clark avatar Byron Clark committed e3f8dc6

Add umount_all.

Comments (0)

Files changed (1)


     udiskie.  path is either the physical device node (e.g. /dev/sdb1) or the
     mount point (e.g. /media/Foo)."""
+    logger = logging.getLogger('udiskie.umount.unmount')
     bus = dbus.SystemBus()
-    logger = logging.getLogger('udiskie.umount.unmount')
     for device in udiskie.device.get_all(bus):
         if path in device.mount_paths() or path == device.device_file():
             logger.debug('Found device owning "%s": "%s"' % (path, device))
             if device.is_handleable() and device.is_mounted():
-      'Unmounting %s (device: %s)' % (path, device))
+                logger.debug('Unmounting %s (device: %s)' % (path, device))
-      'Finished unmounting %s' % (path,))
+      'Unmounted %s' % (path,))
-      'Skipping unhandled device %s' % (device_path,))
+      'Skipping unhandled device %s' % (device,))
+def unmount_all():
+    """Unmount all filesystems handleable by udiskie."""
+    logger = logging.getLogger('udiskie.umount.unmount_all')
+    bus = dbus.SystemBus()
+    for device in udiskie.device.get_all(bus):
+        if device.is_handleable() and device.is_mounted():
+            logger.debug('Unmounting device: %s' % (device,))
+            device.unmount()
+  'Unmounted device: %s' % (device,))
+        else:
+            logger.debug('Skipping unhandled device %s' % (device,))
 def cli(args):
-    for path in args[1:]:
-        unmount(path)
+    unmount_all()
+    #for path in args[1:]:
+    #    unmount(path)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.