def mount_usb( request, device ): """Mounts requested device, adds /var/www/ddr/media symlink, gives feedback. """ logger.debug('mount_usb(devicefile=%s, label=%s)' % (device['devicefile'], device['label'])) logger.debug('device: %s' % device) mount_path = ddrstorage.mount(device['devicefile'], device['label']) logger.debug('mount_path: %s' % mount_path) if mount_path: ddrstorage.unlink() if device.get('mountpath'): ddrstorage.link(device['mountpath']) _mount_common(request, device['devicefile'], device['label'], device['mountpath']) msg = STORAGE_MESSAGES['MOUNT_SUCCESS'].format(device['label']) messages.success(request, msg) elif mount_path == False: msg = STORAGE_MESSAGES['MOUNT_FAIL_PATH'].format( device['devicefile'], device['label'], stat, mount_path) messages.warning(request, msg) else: msg = STORAGE_MESSAGES['MOUNT_FAIL'].format( device['devicefile'], device['label'], stat, mount_path) messages.error(request, msg) return mount_path
def mount( device_file, label ): """Command-line function for mounting specified device on local system. """ return 0,storage.mount(device_file, label)