예제 #1
0
def mount_folder(devices=[]):
    '''
    Mount folder linked to given device.
    '''
    if len(devices) == 0:
        devices = local_config.get_default_devices()

    for name in devices:
        try:
            (url, path) = local_config.get_config(name)
            # try to create the directory if it does not exist
            try:
                os.makedirs(path)
                couchmount.unmount(path)
            except OSError as e:
                if e.errno == errno.EACCES:
                    print 'You do not have sufficient access, ' \
                          'try running sudo %s' % (' '.join(sys.argv[:]))
                    sys.exit(1)
                elif e.errno == errno.EEXIST:
                    pass
                else:
                    continue
            couchmount.mount(name, path)
        except KeyboardInterrupt:
            unmount_folder(name)
예제 #2
0
def mount_folder(name):
    '''
    Mount folder linked to given device.
    '''
    try:
        (url, path) = local_config.get_config(name)
        couchmount.unmount(path)
        couchmount.mount(name, path)
    except KeyboardInterrupt:
        unmount_folder(name)