Exemplo n.º 1
0
 def on_confirm_removal(instance):
     try:
         try:
             actions.remove_device(self.selected_device, popup.cozy_password.text)
         except Exception, e:
             print e
             popup.feedback_message.text = "Wrong password"
             return
         self.initialize_data()
         popup.dismiss()
Exemplo n.º 2
0
def main(argv=sys.argv):
    parser = argparse.ArgumentParser(
        description=DOC, formatter_class=RawTextHelpFormatter)
    parser.add_argument('action',
                        help='Action to perform.')
    parser.add_argument('-p', '--path',
                        help='Path where Cozy files will be mounted')
    parser.add_argument('-u', '--url',
                        help='URL of remote Cozy to sync')
    parser.add_argument('-n', '--name',
                        help='Name of the device on which action occurs')

    args = parser.parse_args()

    if args.action is None:
        parser.print_help()
        print('\nYou must specify an action argument\n')
        sys.exit(2)

    elif args.action == 'configure':
        actions.configure_new_device(args.name, args.url, args.path)

    elif args.action == 'remove_configuration':
        actions.remove_device(args.name)

    elif args.action == 'sync':
        actions.sync(args.name)

    elif args.action == 'mount':
        actions.mount_folder(args.name)

    elif args.action == 'unmount':
        actions.unmount_folder(args.name, args.path)

    elif args.action == 'reset':
        actions.reset()

    elif args.action == 'display_config':
        actions.display_config()

    elif args.action == 'kill_running_replications':
        actions.kill_running_replications()

    else:
        parser.print_help()
        print('\nYou must specify an action argument\n')
Exemplo n.º 3
0
    if args.action is None:
        parser.print_help()
        print('\nYou must specify an action argument\n')
        sys.exit(2)

    elif args.action == 'configure':
        password = retrieve_user_password()
        try:
            actions.configure_new_device(args.name, args.url, args.path, password)
        except Exception, e:
            print e

    elif args.action == 'remove_configuration':
        password = retrieve_user_password()
        try:
            actions.remove_device(args.name, password)
        except Exception, e:
            print e

    elif args.action == 'sync':
        try:
            actions.sync_daemon(args.name)
        except Exception, e:
            print e

    elif args.action == 'mount':
        actions.mount_folder(args.name)

    elif args.action == 'unmount':
        actions.unmount_folder(args.name, args.path)