コード例 #1
0
ファイル: actions.py プロジェクト: poupotte/cozy-fuse-linux
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
ファイル: actions.py プロジェクト: jsilvestre/cozy-fuse-linux
def unmount_folder(name, path=None):
    '''
    Unmount folder linked to given device.
    '''
    if path is None:
        (url, path) = local_config.get_config(name)
    couchmount.unmount(path)
コード例 #3
0
ファイル: actions.py プロジェクト: jsilvestre/cozy-fuse-linux
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)
コード例 #4
0
ファイル: actions.py プロジェクト: poupotte/cozy-fuse-linux
def unmount_folder(devices=[], path=None):
    '''
    Unmount folder linked to given device.
    '''
    if len(devices) == 0:
        devices = local_config.get_default_devices()

    for name in devices:
        if path is None:
            (url, path) = local_config.get_config(name)
        couchmount.unmount(path)
コード例 #5
0
ファイル: actions.py プロジェクト: poupotte/cozy-fuse-linux
def remove_device(device):
    '''
    Remove device from local and remote configuration by:

    * Unmounting device folder.
    * Removing device on corresponding remote cozy.
    * Removing device from configuration file.
    * Destroying corresponding DB.
    '''
    (url, path) = local_config.get_config(device)

    couchmount.unmount(path)
    remove_device_remotely(device)

    # Remove database
    dbutils.remove_db(device)
    dbutils.remove_db_user(device)

    local_config.remove_config(device)
    print 'Configuration %s successfully removed.' % device