__init__.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:swiftbackmeup 作者: redhat-cip 项目源码 文件源码
def restore(self, backup_filename,with_intermediate_file=False):
        """Method to restore the backup."""

        self.store.get(self.swift_container, backup_filename,
                       self.output_directory)
        command = self.build_restore_command(backup_filename)


        if with_intermediate_file:
            file_path = '%s/%s' % (self.output_directory, backup_filename)
            backup_file_content = open(file_path, 'r').read()

            p = subprocess.Popen(command.split(), stdin=subprocess.PIPE)
            p.communicate(backup_file_content)
        else:
            FNULL = open(os.devnull, 'w')
            p = subprocess.Popen(command.split(), stdout=FNULL,
                                 stderr=subprocess.STDOUT)
            p.wait()

        if self.clean_local_copy:
            self._clean_local_copy(backup_filename)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号