Пример #1
0
def configure_new_device(name, url, path, password):
    '''
    * Create configuration for given device.
    * Create database and init CouchDB views.
    * Register device on remote Cozy defined by *url*.
    * Init replications.
    '''
    print 'Welcome to Cozy Fuse!'
    print ''
    print 'Let\'s go configuring your new Cozy connection...'
    (db_login, db_password) = dbutils.init_db(name)


    '''
    if something goes wrong during the initialization,
    we rollback previous operations
    '''
    try:
        local_config.add_config(name, url, path, db_login, db_password)
        print 'Step 1 succeeded: Local configuration created'
        register_device_remotely(name, password)
        print 'Step 2 succeeded: Device registered remotely.'
        print ''
        print 'Now running the first time replication (it could be very long)...'
        init_replication(name)
        print 'Step 3 succeeded: Metadata copied.'
        print ''
        print 'Cozy configuration %s succeeded!' % name
        print 'Now type cozy-fuse sync-n %s to keep your data synchronized.' \
               % name
        print 'And type cozy-fuse mount -n %s to see your files in your ' \
              'filesystem.' % name
    except local_config.LocalDeviceNameAlreadyUsed, e:
        raise ProcessedException(e)
Пример #2
0
def configure_new_device(device, url, path):
    '''
    * Create configuration for given device.
    * Create database and init CouchDB views.
    * Register device on remote Cozy defined by *url*.
    * Init replications.
    '''
    print 'Welcome to Cozy Fuse!'
    print ''
    print 'Let\'s go configuring your new Cozy connection...'
    (db_login, db_password) = dbutils.init_db(device)
    local_config.add_config(device, url, path, db_login, db_password)
    print 'Step 1 succeeded: Local configuration created'
    register_device_remotely(device)
    print 'Step 2 succeeded: Device registered remotely.'
    print ''
    print 'Now running the first time replication (it could be very long)...'
    init_replication(device)
    print 'Step 3 succeeded: Metadata copied.'
    print ''
    print 'Cozy configuration %s succeeded!' % device
    print ''
    if query_yes_no('Do you want to set this device as the default one ?'):
        set_default(device)
    print ''
    if query_yes_no('Do you want to start synchronization now ?'):
        mount_folder([device])
        sync([device])
    else:
        print 'Type "cozy-fuse sync %s" anytime to keep (' \
              'your data synchronized.' % device
        print 'And type "cozy-fuse mount %s" to see your files in your ' \
              'filesystem.' % device
    print ''
    print 'Done!'
Пример #3
0
def configure_new_device(name, url, path):
    '''
    * Create configuration for given device.
    * Create database and init CouchDB views.
    * Register device on remote Cozy defined by *url*.
    * Init replications.
    '''
    print 'Welcome to Cozy Fuse!'
    print ''
    print 'Let\'s go configuring your new Cozy connection...'
    (db_login, db_password) = dbutils.init_db(name)
    local_config.add_config(name, url, path, db_login, db_password)
    print 'Step 1 succeeded: Local configuration created'
    register_device_remotely(name)
    print 'Step 2 succeeded: Device registered remotely.'
    print ''
    print 'Now running the first time replication (it could be very long)...'
    init_replication(name)
    print 'Step 3 succeeded: Metadata copied.'
    print ''
    print 'Cozy configuration %s succeeded!' % name
    print 'Now type cozy-fuse sync-n %s to keep your data synchronized.' % name
    print 'And type cozy-fuse mount -n %s to see your files in your ' \
          'filesystem.' % name