Example #1
0
    def create_archive_blob(self):
        tarball = GlideinTar()
        for k in self.strings.keys():
            tarball.add_string(k, self.strings[k])

        binary_string = tarball.create_tar_blob()
        return binary_string
Example #2
0
    def create_archive_blob(self):
        tarball = GlideinTar()
        for k in self.strings.keys():
            tarball.add_string(k, self.strings[k])

        binary_string = tarball.create_tar_blob()
        return binary_string
Example #3
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)
Example #4
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)
Example #5
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)
        # TODO #23166: Use context managers[with statement] when python 3
        # once we get rid of SL6 and tarballs
        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)
Example #6
0
 def create_archive_file(self):
     random_file_name = create_random_string()
     archive_file = "%s/%s.tar.gz" % (self.working_dir, random_file_name)
     tarball = GlideinTar()
     for f in self.files:
         tarball.add_file(f["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
Example #7
0
 def create_archive_file(self):
     random_file_name = create_random_string()
     archive_file = "%s/%s.tar.gz" % (self.working_dir, random_file_name)
     tarball = GlideinTar()
     for f in self.files:
         tarball.add_file(f["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