def remove_from_object_store(parent, datapath, metapath, auxpath, donepath): """remove all traces from the object store.""" # the order is somewhat significant. # done flag first, metadata next, data last. # then give a shot at the parent directory and beyond. # if any part fails, we give up. if not ryw.cleanup_path(donepath, 'remove_from_object_store, donepath:'): return if not ryw.cleanup_path(auxpath, 'remove_from_object_store, auxpath:'): return if not ryw.cleanup_path(metapath, 'remove_from_object_store, metapath:'): return if not ryw.cleanup_path(datapath, 'remove_from_object_store, datapath:'): return ryw.cleanup_partial_dir(parent, 'remove_from_object_store, parent:', True)
def remove_paths(paths): datapath = paths[0] metapath = paths[1] auxipath = paths[2] donepath = paths[3] mdonpath = paths[4] parent = paths[5] viewpath = paths[6] if viewpath: ryw.cleanup_path(viewpath, 'DeleteObject.remove_paths view:') dir = os.path.dirname(viewpath) ryw.cleanup_partial_dir(dir, 'DeleteObject.remove_paths view:', False, chmodFirst = True) logging.debug('DeleteObject.remove_paths: killed view path: ' + viewpath) storePaths = (datapath,metapath,auxipath,donepath,mdonpath) ryw.remove_all_repo_dirs(storePaths) ryw.cleanup_partial_dir(parent, 'DeleteObject.remove_paths view::', False) logging.debug('DeleteObject.remove_paths: killed store paths: ' + repr(storePaths))
def copy_objectstore(firstRoot, repDir, tmpStoreName): """copies the objectstore minus the big data items. only copying the first root. I assume this is ok. the multiple roots will just get merged over time at one root on the village side.""" dst = os.path.join(repDir, 'ObjectStore') if os.path.exists(tmpStoreName): ryw.give_news2('moving a pre-copied object store... ', logging.info) logging.debug('copy_objectstore: moving a pre-copied store: ' + tmpStoreName) try: shutil.move(tmpStoreName, dst) ryw.cleanup_partial_dir( ryw.parent_dir(tmpStoreName), 'copy_objectstore:', True) except: ryw.give_bad_news('copy_objectstore: failed to move store: ' + tmpStoreName, logging.critical) return False ryw.give_news2('done. ', logging.info) ryw.give_news2('<BR>', logging.info) return True ryw.give_news2('copying object store... ', logging.info) logging.debug('copy_objectstore: ' + firstRoot + ' -> ' + repDir) try: success = ryw_copytree.copy_tree_diff_repo(firstRoot, dst) if not success: raise 'copy_tree_diff_repo failed.' except: ryw.give_bad_news('copy_objectstore: copy_tree_diff_repo failed: '+ firstRoot + ' -> ' + dst, logging.critical) return False logging.debug('copy_objectstore: done: ' + dst) ryw.give_news2('done. ', logging.info) ryw.give_news2('<BR>', logging.info) return True
def remove_view_path(path): """remove view path.""" ryw.cleanup_path(path, 'remove_view_path:') dir = os.path.dirname(path) ryw.cleanup_partial_dir(dir, 'remove_view_path, removedirs:', False)