Esempio n. 1
0
 def create_archive(self):
     random_file_name = create_random_string()
     archive_file = "%s/%s.tar.gz" % (self.working_dir, random_file_name)
     tarball = GlideinTar()
     for file in self.files:
         tarball.add_file(file["path"], "/")
     tarball.create_tar_file(archive_file)
     self.assertTrue(tarball.is_tarfile(archive_file), "Tarball creation failed.  tarball.is_tarfile returned False")
     return archive_file
Esempio n. 2
0
    def extract_archive_blob(self, blob):
        # handle the tarball
        temp_path = create_temp_file(file_dir=self.working_dir, write_path_to_file=False)
        temp_file = open(temp_path, "w")
        temp_file.write(blob)
        temp_file.seek(0)
        temp_file.close()
        shutil.move(temp_path, "%s.tar.gz" % temp_path)

        tarball = GlideinTar()
        self.assertTrue(tarball.is_tarfile("%s.tar.gz" % temp_path), "Blob tarball fails tarball.is_tarfile test")

        self.extract_archive_file("%s.tar.gz" % temp_path)