def restore(self):
"""Restore container files after FileBind"""
error = False
if not os.path.isdir(self.container_orig_dir):
return True
for f_name in os.listdir(self.container_orig_dir):
orig_file = self.container_orig_dir + "/" + f_name
if not os.path.isfile(orig_file):
continue
cont_file = os.path.basename(f_name).replace('#', '/')
cont_file = self.container_root + "/" + cont_file
if os.path.islink(cont_file):
FileUtil(cont_file).remove()
elif os.path.exists(cont_file):
continue
if not FileUtil(orig_file).rename(cont_file):
Msg().err("Error: restoring binded file:", cont_file)
error = True
if not error:
FileUtil(self.container_orig_dir).remove()
FileUtil(self.container_bind_dir).remove()
评论列表
文章目录