Ejemplo n.º 1
0
def rename_action(args: argparse.Namespace) -> int:
    try:
        r = metadata.rename_node(args.node, args.name)
        sync.insert_node(r)
    except RequestError as e:
        print(e)
        return 1
Ejemplo n.º 2
0
def rename_action(args: argparse.Namespace) -> int:
    try:
        r = metadata.rename_node(args.node, args.name)
        sync.insert_node(r)
    except RequestError as e:
        print(e)
        return 1
Ejemplo n.º 3
0
 def _rename(id, name):
     try:
         r = metadata.rename_node(id, name)
     except RequestError as e:
         FuseOSError.convert(e)
     else:
         sync.insert_node(r)
Ejemplo n.º 4
0
 def _rename(id, name):
     try:
         r = metadata.rename_node(id, name)
     except RequestError as e:
         FuseOSError.convert(e)
     else:
         sync.insert_node(r)
Ejemplo n.º 5
0
 def test_rename_node(self):
     nm = gen_rand_nm()
     nm2 = gen_rand_nm()
     node = content.create_file(nm)
     self.assertEqual(node['name'], nm)
     node = metadata.rename_node(node['id'], nm2)
     self.assertEqual(node['name'], nm2)
     trash.move_to_trash(node['id'])
Ejemplo n.º 6
0
 def test_rename_node(self):
     nm = gen_rand_nm()
     nm2 = gen_rand_nm()
     node = content.create_file(nm)
     self.assertEqual(node['name'], nm)
     node = metadata.rename_node(node['id'], nm2)
     self.assertEqual(node['name'], nm2)
     trash.move_to_trash(node['id'])
Ejemplo n.º 7
0
 def _rename(id, name):
     try:
         r = metadata.rename_node(id, name)
     except RequestError as e:
         logger.debug(e)
         if e.status_code == e.CODE.CONN_EXCEPTION:
             raise FuseOSError(errno.ECOMM)
         elif e.status_code == 409:
             raise FuseOSError(errno.EEXIST)
         else:
             raise FuseOSError(errno.EREMOTEIO)
     else:
         sync.insert_node(r)
Ejemplo n.º 8
0
 def rename(self, old, new):
     id = query.resolve_path(old)
     new = os.path.basename(new)
     try:
         r = metadata.rename_node(id, new)
         sync.insert_node(r)
     except RequestError as e:
         if e.status_code == e.CODE.CONN_EXCEPTION:
             raise FuseOSError(errno.ECOMM)
         elif e.status_code == 409:
             raise FuseOSError(errno.EEXIST)
         else:
             raise FuseOSError(errno.EREMOTEIO)