Ejemplo n.º 1
0
def unregister_device(device):
    '''
    Remove device from local configuration, destroy corresponding database
    and unregister it from remote Cozy.
    '''
    (url, path) = local_config.get_config(device)
    (device_id, device_password) = local_config.get_device_config(device)

    print 'Cozy connection removal for %s.' % device
    local_config.remove(device)
    print '- Local configuration removed.'
    dbutils.remove_db(device)
    print '- Local files removed.'
    password = getpass.getpass('Please type the password of your Cozy:\n')
    remote.remove_device(url, device_id, password)
    print '- Remote configuration removed.'
    print 'Removal succeeded, everything clean!' % device
Ejemplo n.º 2
0
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