Skip to content

Commit

Permalink
Fix creation of ova with encoded ovf
Browse files Browse the repository at this point in the history
The size of the entry in the tar file for the OVF should match the
length of the encoded ovf, otherwise the OVF parsing fails in case the
encoded OVF is longer.

Signed-off-by: Arik Hadas <ahadas@redhat.com>
  • Loading branch information
ahadas committed Sep 10, 2023
1 parent c4fe7d6 commit c5da78e
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ def pad_to_block_size(file):

def write_ovf(entity, ova_file, ovf):
print("writing ovf: %s" % ovf)
tar_info = create_tar_info(entity + ".ovf", len(ovf))
encoded_ovf = ovf if python2 else ovf.encode()
tar_info = create_tar_info(entity + ".ovf", len(encoded_ovf))
buf = (tar_info.tobuf() if python2 else
tar_info.tobuf(format=tarfile.GNU_FORMAT))
ova_file.write(buf)
ova_file.write(ovf if python2 else ovf.encode())
ova_file.write(encoded_ovf)
pad_to_block_size(ova_file)


Expand Down

0 comments on commit c5da78e

Please sign in to comment.